class Name [(Parameter, ...)] [% Inherit] [public Library] [Alignment] is Field, ... type Name [% Inherit] [public Library] [Alignment] is Field, ...
A class module declares a user defined type and its member methods, specifies the source language for each member and includes other classes used by this class.
Where Type is a type name or in the case of a variant pointer, a list of type names. Where Alignment is a constant integer expression or an integer type name: byte parcel word cell Where a field has one of these forms: [+|-] [@|*] Name [(Range)] [= Value] [Type] :A data field, uses storage. [+|-] Name |= Static :A micro field, no storage. [+|-] Name [(Parameter, ...)] => Macro :A macro declaration. Where Range is: { [Low TO] High, Enumeration }
@Name [= 0] Type '|' Type [ '|' ... ] *Name [= 0] Type '|' Type [ '|' ... ]
Variant pointers can reference one of several types or contain zero to indicate a null pointer. Note that variant pointers can not encode Parcel values other than zero. Data cannot be accessed directly through a variant pointer. To do this you must first assign the variant pointer to an invariant pointer. The current type of the variant pointer must match or zero will be assigned.
A variant pointer may be assigned to the address of an object or the address in an invariant pointer. The type of the variable or invariant pointer must be in the variant type list.
Variant = @Variable :Point a variant pointer at a variable. Variant = @Pointer :Set a variant pointer to an invariant pointer.
A variant pointer may also be assigned to the address in another variant pointer, but only if the type lists match and are declared in the same order.
Variant = @Variant :Copy one variant pointer to another.
There must be fewer types in the list of types than the smallest alignment of the types in the list. For example, if the smallest alignment is a Word (4 bytes) the list can contain either two or three types. Consequently variants cannot reference byte or parcel aligned objects.
Pointer = @Variant :Cast a variant to an invariant pointer.
The current type contained in a variant pointer can be determined using the Parcel function. It will returns the position of the type corresponding to the current setting or zero if the variant pointer is set to zero.
Index = parcel( @Variant )