The module CharClass provides predicates to test if a given value of the character type in an implementation is classified as a numeric, a letter, an upper-case letter, a lower-case letter, a value representing a control function, or as white space.
PROCEDURE IsNumeric (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsNumeric returns TRUE if ch is a member of an implementation-defined set of numeric characters that should include the decimal digits, and FALSE otherwise.
PROCEDURE IsLetter (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsLetter returns TRUE if ch is a member of an implementation-defined set of letters that should include the required letters, and FALSE otherwise.
PROCEDURE IsUpper (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsUpper returns TRUE if ch is a member of an implementation-defined set of upper case letters that should include the required upper case letters, and FALSE otherwise.
PROCEDURE IsLower (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsLower returns TRUE if ch is a member of an implementation-defined set of lower case letters that should include the required lower case letters, and FALSE otherwise.
PROCEDURE IsControl (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsControl returns TRUE if ch is a member of an implementation-defined set of characters that represent control functions, and FALSE otherwise.
PROCEDURE IsWhiteSpace (ch: CHAR): BOOLEAN;
Module CharClass
The function procedure IsWhiteSpace returns TRUE if ch is either a space character or a member of an implementation-defined set of characters that represent format effectors, and FALSE otherwise.
The module LowReal gives access to the underlying properties of the type REAL, while LowLong gives access to the same properties for the type LONGREAL.
For implementations that conform to ISO/IEC 10967-1:199x Information technology - Language independent arithmetic - Part1: Integer and floating point arithmetic, a more precise specification is given in that International Standard.
If the implementation of the corresponding real number type conforms to ISO/IEC 10967-1:199x (LIA-1), procedure functions of a similar name correspond to the operations required by that International Standard.
CONST radix = <implementation-defined whole number value>; places = <implementation-defined whole number value>; expoMin = <implementation-defined whole number value>; expoMax = <implementation-defined whole number value>; large = <implementation-defined real number value>; small = <implementation-defined real number value>; IEC559 = <implementation-defined BOOLEAN value>; LIA1 = <implementation-defined BOOLEAN value>; rounds = <implementation-defined BOOLEAN value>; gUnderflow = <implementation-defined BOOLEAN value>; exception = <implementation-defined BOOLEAN value>; extend = <implementation-defined BOOLEAN value>; nModes = <implementation-defined whole number value>; TYPE Modes = PACKEDSET OF [0 .. nModes-1];
The values denoted by the constant identifiers exported from LowReal and LowLong are the implementation-defined values specified below.
If an implementation provides facilities for dynamically changing the properties of the real number types, the constant values refer to the default properties.
The value of places, and the other facilities in these modules, refer only to the representation used to store values.
NOTE: Some implementations may choose to compute expressions to greater precision than that used to store values.
If the implementation of the corresponding real number type conforms to ISO/IEC 10967-1:199x (LIA-1), the following correspondences hold:
NOTE: The value of the parameter fmax, required by ISO/IEC 10967-1:199x, is given by the predefined function MAX when applied to the corresponding real number type.
NOTES:
NOTE: For implementations not conforming to ISO/IEC 10967-1:199x, the corresponding properties are implementation-defined | see 6.8.2.2.
NOTE: If rounds is true, and the mathematical result lies mid-way between two values of the corresponding real number type, then the selection from the two possible values is implementation-dependent.
NOTE: If extend is true, then values greater than large can be computed in expressions, but cannot be stored in variables.
PROCEDURE exponent (x: REAL): INTEGER; PROCEDURE exponent (x: LONGREAL): INTEGER;
The function procedure exponent returns the exponent value of x that lies between expoMin and expoMax. An exception occurs and may be raised if x is equal to 0.0.
PROCEDURE fraction (x: REAL): REAL; PROCEDURE fraction (x: LONGREAL): LONGREAL;
The function procedure fraction returns the significand (or significant) part of x. Hence the following relationship shall hold:
x = scale(fraction(x), exponent(x))
PROCEDURE sign (x: REAL): REAL; PROCEDURE sign (x: LONGREAL): LONGREAL;
The function procedure sign returns 1.0 if x is greater than 0.0, -1.0 if x is less than 0.0, or either 1.0 or -1.0 if x is equal to 0.0.
NOTE: The uncertainty about the handling of 0.0 is to allow for systems that distinguish between +0.0 and -0.0 (such as IEEE 754 systems).
PROCEDURE succ (x: REAL): REAL; PROCEDURE succ (x: LONGREAL): LONGREAL;
The function procedure succ returns the next value of the corresponding real number type greater than x, if such a value exists; otherwise an exception occurs and may be raised.
PROCEDURE ulp (x: REAL): REAL; PROCEDURE ulp (x: LONGREAL): LONGREAL;
The function procedure ulp returns the value of the corresponding real number type equal to a unit in the last place of x, if such a value exists; otherwise an exception occurs and may be raised.
NOTE: Thus, when the value exists, either ulp(x) = succ(x)-x or ulp(x) = x-pred(x) or both is true.
PROCEDURE pred (x: REAL): REAL; PROCEDURE pred (x: LONGREAL): LONGREAL;
The function procedure pred returns the next value of the corresponding real number type less than x, if such a value exists; otherwise an exception occurs and may be raised.
PROCEDURE intpart (x: REAL): REAL; PROCEDURE intpart (x: LONGREAL): LONGREAL;
The function procedure intpart returns the integral part of x. For negative values, this shall be -intpart(abs(x)).
PROCEDURE fractpart (x: REAL): REAL; PROCEDURE fractpart (x: LONGREAL): LONGREAL;
The function procedure fractpart returns the fractional part of x. This satisfies the relationship fractpart(x)+intpart(x)=x.
PROCEDURE scale (x: REAL; n: INTEGER): REAL; PROCEDURE scale (x: LONGREAL; n: INTEGER): LONGREAL;
The function procedure scale returns the value x * radix ** n if such a value exists; otherwise an exception occurs and may be raised.
PROCEDURE trunc (x: REAL; n: INTEGER): REAL; PROCEDURE trunc (x: LONGREAL; n: INTEGER): LONGREAL;
The function procedure trunc returns the value of the most significant n places of x. An exception occurs and may be raised if n is less than or equal to zero.
PROCEDURE round (x: REAL; n: INTEGER): REAL; PROCEDURE round (x: LONGREAL; n: INTEGER): LONGREAL;
The function procedure round returns the value of x rounded to the most significant n places. An exception occurs and may be raised if such a value does not exist, or if n is less than or equal to zero.
PROCEDURE synthesize (expart : INTEGER; frapart: REAL): REAL; PROCEDURE synthesize (expart : INTEGER; frapart: LONGREAL): LONGREAL;
The function procedure synthesize returns a value of the corresponding real number type constructed from the values of expart and frapart. This value shall satisfy the relationship:
synthesize(exponent(x),fraction(x))=x
PROCEDURE setMode (m: Modes); PROCEDURE setMode (m: Modes);
The procedure setMode sets status flags from the value of m, appropriate to the underlying implementation of the corresponding real number type. NOTES:
PROCEDURE currentMode (): Modes; PROCEDURE currentMode (): Modes;
The function procedure currentMode returns the current status flags (in the form set by setMode), or the default status flags (if setMode is not used).
NOTE: The returned value is not necessarily the value set by setMode, since a call of setMode might attempt to set flags that cannot be set by the program.
PROCEDURE IsLowException (): BOOLEAN; PROCEDURE IsLowException (): BOOLEAN;
If the calling coroutine is in the state of exceptional execution because of the raising of the LowReal exception, the function procedure LowReal.IsLowException returns TRUE; otherwise is returns FALSE.
If the calling coroutine is in the state of exceptional execution because of the raising of the LowLong exception, the function procedure LowLong.IsLowException returns TRUE; otherwise is returns FALSE.
The semantics are described in terms of allocating storage for a variable since the allocator must take account of any address alignment requirements for the storage of variables of the given size. CLARIFICATIONS
TYPE StorageExceptions = ( nilDeallocation, (* first argument to DEALLOCATE is NIL *) pointerToUnallocatedStorage, (* storage to deallocate not allocated by ALLOCATE *) wrongStorageToUnallocate (* amount to deallocate is not amount allocated *) );
Module Storage
The exceptions raised by Storage are identified by the values of the enumeration type StorageExceptions.
The detection of the exception wrongStorageToUnallocate is implementation-defined.
PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
Module Storage
The procedure ALLOCATE allocates storage for a variable of size amount, and assigns the address of this variable to addr. The allocated locations will not be in use for the storage of any other variable. If it is not possible to allocate this storage, the value NIL is assigned to addr.
NOTES:
PROCEDURE DEALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL);
Module Storage
The procedure DEALLOCATE deallocates amount locations for the storage of the variable addressed by addr and assigns the value NIL to addr.
The exception nilDeallocation is raised if the given value of addr is the nil value. The exception pointerToUnallocatedStorage is raised if the given value of addr is not the address of a variable whose storage has been allocated by ALLOCATE. The exception wrongStorageToUnallocate occurs and may be raised if amount is not equal to the number of locations allocated for the storage of the variable addressed by addr.
NOTES:
PROCEDURE IsStorageException (): BOOLEAN;
Module Storage
If the calling coroutine is in the state of exceptional execution because of the raising of a Storage exception, the function procedure IsStorageException returns TRUE; otherwise it returns FALSE.
PROCEDURE StorageException (): StorageExceptions;
Module Storage
If the calling coroutine is in the state of exceptional execution because of the raising of a Storage exception, the function procedure StorageException returns the value that identifies the raised exception; otherwise the language exception exException is raised.
The field summerTimeFlag is present for information only. UTC can always be obtained by subtracting the UTCDiff value from the time data, regardless of the value of the summerTimeFlag. However, its presence does allow a program to know whether or not the date and time data represents standard time for that location, or `summer time'. A program could therefore be written to change the system clock to summer time automatically on a certain date, provided it had not already been changed.
CONST maxSecondParts = <implementation-defined integral value>; TYPE Month = [1 .. 12]; Day = [1 .. 31]; Hour = [0 .. 23]; Min = [0 .. 59]; Sec = [0 .. 59]; Fraction = [0 .. maxSecondParts]; UTCDiff = [-780 .. 720]; DateTime = RECORD year: CARDINAL; month: Month; day: Day; hour: Hour; minute: Min; second: Sec; fractions: Fraction; (* parts of a second *) zone: UTCDiff; (* Time zone differential factor which is the number of minutes to add to local time to obtain UTC. *) summerTimeFlag: BOOLEAN; (* Interpretation of flag depends on local usage. *) END;
PROCEDURE CanGetClock (): BOOLEAN;
Module SysClock
The function procedure CanGetClock returns an implementation-defined BOOLEAN value. If the value TRUE is returned, there is a system clock which the program is permitted to read.
PROCEDURE CanSetClock (): BOOLEAN;
Module SysClock
The function procedure CanSetClock() returns an implementation-defined BOOLEAN value. If the value TRUE is returned, there is a system clock which the program is permitted to set.
PROCEDURE IsValidDateTime (userData: DateTime): BOOLEAN;
Module SysClock
The function procedure IsValidDateTime returns TRUE if the value of userData represents a valid date and time, and is FALSE otherwise. NOTE: Only the date components of userData need to be validated since all combinations of values of the time components are known to be valid.
PROCEDURE GetClock (VAR userData: DateTime);
Module SysClock
The function procedure GetClock assigns values for each field of the variable userData for which information is available. Each of the remaining fields of userData are set to zero, where this is a valid value, and otherwise are set to the lower bound of the range of allowed values.
PROCEDURE SetClock (userData: DateTime);
Module SysClock
The function procedure SetClock sets the system clock to the date and time specified by userData, provided that the program may set the system clock, and that the value of userData represents a valid date and time. If the program cannot set the system clock, a call of SetClock have no effect.
NOTE: The effect of a call of SetClock is implementation-dependent if it is permitted to set the system clock, but an invalid date and time is given.