| Libraries |  | Enumeration | Source Code |  | 
 | 
| Abstract data types | |||||
| type | 
 | ||||
new enum
const func type: new enum (ref expr: elem_expr) end enum
- 
Abstract data type, describing enumeration types. To define a new enumeration type the desired enumeration literals must be listed. Commas must seperate the enumeration literals. const type: enumType is new enum enum_literal1, enum_literal2 end enum;In order to do I/O for a new enumeration type it is necessary to define the functions str and parse. const func string: str (in enumType: enumValue) is return literal(enumValue); enable_output(enumType);
| Operator Summary | |||||
| enumType | 
 | ||||
| enumType | 
 | ||||
| enumType | 
 | ||||
| boolean | 
 | ||||
| boolean | 
 | ||||
| enumType | 
 | ||||
| integer | 
 | ||||
| Function Summary | |||||
| string | 
 | ||||
| integer | 
 | ||||
| integer | 
 | ||||
| integer | 
 | ||||
| integer | 
 | ||||
| enumType | 
 | ||||
| enumType | 
 | ||||
| void | 
 | ||||
| void | 
 | ||||
| enumType | 
 | ||||
| Operator Detail | 
=
const func boolean: (in enumType: enum1) = (in enumType: enum2)
- 
Check if two enumeration values are equal. 
- Returns:
- TRUE if the two enumeration values are equal, FALSE otherwise.
 
<>
const func boolean: (in enumType: enum1) <> (in enumType: enum2)
- 
Check if two enumeration values are not equal. 
- Returns:
- FALSE if the two enumeration values are equal, TRUE otherwise.
 
conv
const func enumType: (attr enumType) conv (in integer: number)
- 
Conversion from integer number to enumType. The first enumeration literal of enumType corresponds to 0. 
- Returns:
- the corresponding enumeration value.
 
- Raises:
- RANGE_ERROR - If number is neither 0 nor 1.
 
conv
const func integer: (attr integer) conv (in enumType: enumValue)
| Function Detail | 
literal
const func string: literal (in enumType: enumValue)
- 
Convert an enumeration value to the corresponding literal. 
- Returns:
- the enumeration literal.
 
- Raises:
- MEMORY_ERROR - Not enough memory to represent the result.
 
ord
const func integer: ord (in enumType: enumValue)
integer
const func integer: integer (in enumType: enumValue)
hashCode
const func integer: hashCode (in enumType: enumValue)
- 
Compute the hash value of an enumeration value. 
- Returns:
- the hash value.
 
compare
const func integer: compare (in enumType: enum1, in enumType: enum2)
- 
Compare two enumeration values. 
- Returns:
- -1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.
 
succ
const func enumType: succ (in enumType: enumValue)
- 
Successor of enumValue. succ(enumType.last) raises RANGE_ERROR 
- Returns:
- the successor of enumValue.
 
- Raises:
- RANGE_ERROR - If enumValue is the last value of the enumeration.
 
pred
const func enumType: pred (in enumType: enumValue)
- 
Predecessor of enumValue. pred(enumType.first) raises RANGE_ERROR 
- Returns:
- the predecessor of enumValue.
 
- Raises:
- RANGE_ERROR - If enumValue is the first value of the enumeration.
 
incr
const proc: incr (inout enumType: enumValue)
- 
Increment an enumeration variable. 
- Raises:
- RANGE_ERROR - If enumValue is the last value of the enumeration.
 
decr
const proc: decr (inout enumType: enumValue)
- 
Decrement an enumeration variable. 
- Raises:
- RANGE_ERROR - If enumValue is the first value of the enumeration.
 
rand
const func enumType: rand (in enumType: low, in enumType: high)
- 
Compute pseudo-random enumeration value in the range [low, high]. The random values are uniform distributed. 
- Returns:
- a random value such that low <= rand(low, high) and rand(low, high) <= high holds.
 
- Raises:
- RANGE_ERROR - The range is empty (low > high holds).
 
|  | 
 | 

