NAME ^

runtime/wmlslang.pir - WMLScript Lang library

DESCRIPTION ^

This library contains a set of functions that are closely related to the WMLScript language core.

See "WMLScript Standard Libraries Specification", section 7 "Lang".

FUNCTIONS ^

abs(value) ^

DESCRIPTION

Returns the absolute value of the given number. If the given number is of type integer then an integer value is returned. If the given number is of type floating-point then a floating-point value is returned.

PARAMETERS

value = Number

RETURN VALUE

Number or invalid.

min(value1, value2) ^

DESCRIPTION

Returns the minimum value of the given two numbers. The value and type returned is the same as the value and type of the selected number. The selection is done in the following way:

PARAMETERS

value1 = Number

value2 = Number

RETURN VALUE

Number or invalid.

max(value1, value2) ^

DESCRIPTION

Returns the maximum value of the given two numbers. The value and type returned is the same as the value and type of the selected number. The selection is done in the following way:

PARAMETERS

value1 = Number

value2 = Number

RETURN VALUE

Number or invalid.

parseInt(value) ^

DESCRIPTION

Returns an integer value defined by the string value. The legal integer syntax is specified by the WMLScript (see [WMLScript]) numeric string grammar for decimal integer literals with the following additional parsing rule:

The result is the parsed string converted to an integer value.

PARAMETERS

value = String

RETURN VALUE

Integer or invalid.

EXCEPTIONS

In case of a parsing error an invalid value is returned.

parseFloat(value) ^

DESCRIPTION

Returns a floating-point value defined by the string value. The legal floatingpoint syntax is specified by the WMLScript (see [WMLScript]) numeric string grammar for decimal floating-point literals with the following additional parsing rule:

The result is the parsed string converted to a floating-point value.

PARAMETERS

value = String

RETURN VALUE

Floating-point or invalid.

EXCEPTIONS

In case of a parsing error an invalid value is returned.

isInt(value) ^

DESCRIPTION

Returns a boolean value that is true if the given value can be converted into an integer number by using parseInt(value). Otherwise false is returned.

PARAMETERS

value = Any

RETURN VALUE

Boolean or invalid.

isFloat(value) ^

DESCRIPTION

Returns a boolean value that is true if the given value can be converted into a floating-point number using parseFloat(value). Otherwise false is returned.

PARAMETERS

value = Any

RETURN VALUE

Boolean or invalid.

maxInt() ^

DESCRIPTION

Returns the maximum integer value.

RETURN VALUE

Integer 2147483647.

minInt() ^

DESCRIPTION

Returns the minimum integer value.

RETURN VALUE

Integer -2147483648.

float() ^

DESCRIPTION

Returns true if floating-points are supported and false if not.

RETURN VALUE

Boolean.

exit(value) ^

DESCRIPTION

Ends the interpretation of the WMLScript bytecode and returns the control back to the caller of the WMLScript interpreter with the given return value. This function can be used to perform a normal exit from a function in cases where the execution of the WMLScript bytecode should be discontinued.

PARAMETERS

value = Any

RETURN VALUE

None (this function ends the interpretation).

abort(errorDescription) ^

DESCRIPTION

Aborts the interpretation of the WMLScript bytecode and returns the control back to the caller of the WMLScript interpreter with the return errorDescription. This function can be used to perform an abnormal exit in cases where the execution of the WMLScript should be discontinued due to serious errors detected by the program. If the type of the errorDescription is invalid, string "invalid" is used as the errorDescription instead.

PARAMETERS

errorDescription = String

RETURN VALUE

None (this function aborts the interpretation).

random(value) ^

DESCRIPTION

Returns an integer value with positive sign that is greater than or equal to 0 but less than or equal to the given value. The return value is chosen randomly or pseudo-randomly with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy.

If the value is of type floating-point, Float.int() is first used to calculate the actual integer value.

PARAMETERS

value = Number

RETURN VALUE

Integer or invalid.

EXCEPTIONS

If value is equal to zero (0), the function returns zero.

If value is less than zero (0), the function returns invalid.

seed(value) ^

DESCRIPTION

Initialises the pseudo-random number sequence and returns an empty string. If the value is zero or a positive integer then the given value is used for initialisation, otherwise a random, system dependent initialisation value is used. A seed value of greater than or equal to zero results in a repeatable sequence of pseudo-random numbers. A seed value of less than zero results in a non-repeatable sequence of random numbers.

If the value is of type floating-point, Float.int() is first used to calculate the actual integer value. . If the value is non-numeric, invalid is returned and the current seed is unchanged.

PARAMETERS

value = Number

RETURN VALUE

String or invalid.

characterSet() ^

DESCRIPTION

Returns the character set supported by the WMLScript Interpreter. The return value is an integer that denotes a MIBEnum value assigned by the IANA for all character sets (see [WSP] for more information).

RETURN VALUE

Integer.

AUTHORS ^

Francois Perrad.


parrot