Previous

Contents

Next

Appendix C: Language-defined attributes


This appendix is fairly lax with its terminology. In particular I use the term ‘type’ instead of ‘subtype’ for simplicity, but this is not entirely accurate, particularly for floating point types. Treat this as an outline guide, and see annex K of the Ada 95 Reference Manual for the full story. The language-defined attributes are as follows:

P'Access

(P: any subprogram) An access value for the subprogram P.

X'Access

(X: any aliased object) An access value for X.

X'Address

(X: any object or program unit) The address of the first of the storage elements allocated to X as a value of type System.Address.

S'Adjacent

(S: any floating point type) A function which returns the adjacent machine number to the first parameter in the direction of the value of the second parameter.

S'Aft

(S: any fixed point type) The number of decimal digits needed after the decimal point to accommodate the delta of S as a universal_integer.

X'Alignment

(X: any type or object) The alignment of X in memory as a universal_integer.

S'Base

(S: any scalar type) The unconstrained base type of S.

S'Bit_Order

(S: any record type) The bit ordering for S as a value of type System.Bit_Order.

P'Body_Version

(P: any program unit) A String that identifies the version of the body of the compilation unit containing P.

T'Callable

(T: any task) True when T is callable.

E'Caller

(E: an entry name) A value of the type Task_ID that identifies the task whose call to E is now being serviced.

S'Ceiling

(S: any floating point type) A function which returns the smallest integral value greater than or equal to its parameter.

S'Class

(S: any tagged type) The class-wide type for the class rooted at S.

X'Component_Size

(X: any array type or object) The size in bits of the components of X as a universal_integer.

S'Compose

(S: any floating point type) A function which combines a fraction given as its first parameter and an exponent given as its second parameter into a floating point value.

A'Constrained

(A: any discriminated type) True if A is constrained.

S'Copy_Sign

(S: any floating point type) A function which returns a value whose magnitude is that of its first parameter but with the same sign as its second parameter.

E'Count

(E: any entry name) The number of calls presently queued on E as a universal_integer.

S'Definite

(S: any formal indefinite type) True if the actual type of S is definite.

S'Delta

(S: any fixed point type) The delta of S as a universal_real.

S'Denorm

(S: any floating point type) True if denormalised values of S are machine numbers.

S'Digits

(S: any decimal or floating point type) The number of digits for S as a universal_integer.

S'Exponent

(S: any floating point type) A function which returns the normalised exponent of its parameter as a universal_integer.

S'External_Tag

(S: any tagged type) A representation of S'Tag as a String.

A'First(N)

(A: any array) The lower bound of the N-th index range of A.

A'First

(A: any array) The lower bound of the first index range of the array A.

S'First

(S: any scalar type) The lower bound of the range of S.

R.C'First_Bit

(R.C: any component C of a record type R) The number of bits to the first bit of C within R as a universal_integer.

S'Floor

(S: any floating point type) A function which returns the largest integral value less than or equal to its parameter.

S'Fore

(S: any fixed point type) The minimum number of characters needed before the decimal point for the decimal representation of any value of S as a universal_integer.

S'Fraction

(S: any floating point type) A function which returns the fractional part of its parameter.

E'Identity

(E: any exception) The unique identity of E as a value of type Exception_Id.

T'Identity

(T: any task) A value of the type Task_ID that identifies T.

S'Image

(S: any scalar type) A function which returns an image of its parameter as a String.

S'Input

(S: any type) A function which reads and returns a value of type S from the stream given as its parameter.

S'Class'Input

(S'Class: any class-wide type) A function which reads a tag from the stream given as its parameter, dispatches to the subprogram denoted by the Input attribute of the specific type identified by the tag and returns that result.

A'Last(N)

(A: any array) The upper bound of the N-th index range of A.

A'Last

(A: any array) The upper bound of the first index range of A.

S'Last

(S: any scalar type) The upper bound of the range of S.

R.C'Last_Bit

(R.C: any component C of a record type R) The number of bits to the last bit of C within R as a universal_integer.

S'Leading_Part

(S: any floating point type) A function which returns the leading part of its first parameter with the number of radix digits given by its second parameter.

A'Length(N)

(A: any array) The length of the N-th dimension of A as a universal_integer.

A'Length

(A: any array) The length of the first dimension of A as a universal_integer.

S'Machine

(S: any floating point type) A function which returns the nearest machine-representable number to its parameter.

S'Machine_Emax

(S: any floating point type) The largest exponent of S as a universal_integer.

S'Machine_Emin

(S: any floating point type) The smallest exponent of the floating point type S as a universal_integer.

S'Machine_Mantissa

(S: any floating point type) The number of digits in the machine representation of the mantissa of S as a universal_integer.

S'Machine_Overflows

(S: any real type) True if overflow and divide-by-zero are detected and reported by raising Constraint_Error for every predefined operation that yields a result of type S.

S'Machine_Radix

(S: any real type) The radix of the hardware representation of S as a universal_integer.

S'Machine_Rounds

(S: any real type) True if rounding is performed on inexact results of every predefined operation that yields a result of type S.

S'Max

(S: any scalar type) A function which returns the greater of the values of its two parameters.

S'Max_Size_In_Storage_Elements

(S: any type) The maximum number of storage elements of type S that will be requested via System.Storage_Pools.Allocate for an access-to-S type as a universal_integer.

S'Min

(S: any scalar type) A function which returns the lesser of the values of the two parameters.

S'Model

(S: any floating point type) A function which returns a model number which is adjacent to the value of its parameter.

S'Model_Emin

(S: any floating point type) The model number corresponding to S'Machine_Emin.

S'Model_Epsilon

(S: any floating point type) The absolute difference between 1.0 and the next higher model number of S as a universal_real.

S'Model_Mantissa

(S: any floating point type) The model number corresponding to S'Machine_Mantissa.

S'Model_Small

(S: any floating point type) The smallest positive model number of S as a universal_real.

S'Modulus

(S: any modular type) The modulus of S as a universal_integer.

S'Output

(S: any type) A procedure which writes its second parameter to the stream given by its first parameter, including any bounds or discriminants.

S'Class'Output

(S'Class: any class-wide type) A procedure which writes the tag of its second parameter to the stream given by its first parameter and then dispatches to the subprogram denoted by the Output attribute for the specific type identified by the second parameter’s tag.

D'Partition_ID

(D: any library-level declaration) A universal_integer that identifies the partition in which D was elaborated.

S'Pos

(S: any discrete type) A function which returns the position number of its parameter as a universal_integer.

R.C'Position

(R.C: any component C of a record type R) The same as R.C'Address – R'Address.

S'Pred

(S: any discrete type) A function which returns the value whose position number is one less than that of its parameter.

A'Range(N)

(A: any array type) Equivalent to A'First(N) .. A'Last(N), except that A is only evaluated once.

A'Range

(A: any array type) Equivalent to A'First .. A'Last, except that A is only evaluated once.

S'Range

(S: any scalar type) Equivalent to the range S'First .. S'Last.

S'Read

(S: any type) A procedure which reads its second parameter from the stream given by its first parameter.

S'Class'Read

(S'Class: any class-wide type) A procedure which dispatches to the subprogram denoted by the Read attribute of the specific type identified by the tag of its second parameter.

S'Remainder

(S: any floating point type) A function which returns the remainder of dividing the first parameter by the second.

S'Round

(S: any fixed point type) A function which returns the rounded value of its parameter.

S'Rounding

(S: any floating point type) A function which returns the integral value nearest to its parameter.

S'Safe_First

(S: any floating point type) The lower bound of the safe range of S as a universal_real.

S'Safe_Last

(S: any floating point type) The upper bound of the safe range of S as a universal_real.

S'Scale

(S: any fixed point type) The position of the point relative to the rightmost significant digit of values of S as a universal_integer.

S'Scaling

(S: any floating point type) A function which scales its first parameter by the machine radix raised to the power of its second parameter.

S'Signed_Zeros

(S: any floating point type) True if the hardware representation for the S has the capability of representing both positively and negatively signed zeros.

X'Size

(X: any type or object) The size in bits of X as a universal_integer.

S'Small

(S: any fixed point type) The ‘small’ of S, i.e. the smallest value of the internal type used to represent S, as a universal_real.

S'Storage_Pool

(S: any access type) The storage pool used for S as a value of type Root_Storage_Pool'Class.

S'Storage_Size

(S: any access type) The result of calling Storage_Size(S'Storage_Pool).

T'Storage_Size

(S: any task) The number of storage elements reserved for T as a universal_integer.

S'Succ

(S: any scalar type) A function which returns the value whose position number is one more than that of the value of its parameter.

X'Tag

(X: any tagged type or class-wide object) The tag of X as a value of type Ada.Tags.Tag.

T'Terminated

(T: any task) True if T is terminated.

S'Truncation

(S: any floating point type) A function which truncates its parameter towards zero.

S'Unbiased_Rounding

(S: any floating point type) A function which returns the integral value nearest to its parameter, rounding towards the even integer if the parameter lies exactly halfway between two integers.

X'Unchecked_Access

(X: any aliased object) The same as X'Access except that accessibility checks are not performed.

S'Val

(S: any discrete type) A function which returns a value of type S whose position number equals the value of its parameter.

X'Valid

(X: any scalar object) True if X is normal and has a valid representation.

S'Value

(S: any scalar type) A function which returns a value of type S given an image of the value as a String, ignoring any leading or trailing spaces.

P'Version

(P: any program unit) A String that identifies the version of the compilation unit that contains the declaration of P.

S'Wide_Image

(S: any scalar type) A function which returns an image of its parameter as a Wide_String.

S'Wide_Value

(S: any scalar type) A function which returns a value of type S given an image of the value as a Wide_String, ignoring any leading or trailing spaces.

S'Wide_Width

(S: any scalar type) The maximum length of a Wide_String returned by S'Wide_Image as a universal_integer.

S'Width

(S: any scalar type) The maximum length of a String returned by S'Image as a universal_integer.

S'Write

(S: any type) A procedure which writes the value of its second parameter to the stream given by its first parameter.

S'Class'Write

(S'Class: any class-wide type) A procedure which dispatches to the subprogram denoted by the Write attribute of the specific type identified by the tag of its second parameter.



Previous

Contents

Next

This file is part of Ada 95: The Craft of Object-Oriented Programming by John English.
Copyright © John English 2000. All rights reserved.
Permission is given to redistribute this work for non-profit educational use only, provided that all the constituent files are distributed without change.
$Revision: 1.2 $
$Date: 2001/11/17 12:00:00 $