ENUM / OPTLIST

Syntax

[ENUM=name,string1,value1,string2,value2...]
[ENUM,string1,value1,string2,value2...]
[OPTLIST=name,string1,value1...]

An enumeration (formerly ‘Option List’) allows a value to be represented by a string of text. Within GW the type (typically an option) can be modified by selecting a string from a pull-down list of strings within a combo box.

An enumeration is typically defined at the beginning of a file after a comment. A square bracket followed by the text ‘ENUM’ (or, for backwards compatibility, ‘OPTLIST’), any number of subsequent value/string pairs and a terminating close square bracket define an enumeration. For example:

1;[ENUM,0,OFF,1,ON,2?,UNDEFINED]
2;[OPTLIST,0,OFF,1,ON,2,UNDEFINED]

If an enumeration has no entries, anything defined to use it will not use it. This allows an enumeration definition to be undefined (typically for debugging) by placing the ‘]’ after the ENUM:

1;[ENUM], 0,OFF,1,ON,2,UNDEFINED

This creates an empty enumeration definition in the GIN file in order to maintain the index numbering. This is useful if you are using the legacy index based “ol” referencing for parameters, options etc.

Enumerations may be tagged with an identifier to allow name-based lookup by other types. This is highly recommended because it reduces hard coding and eases code maintenance:

1;[ENUM=Troolean,0,OFF,1,ON,2,MAYBE]

Type specifiers may be used. Useful if the value cannot be reasonably represented using a 32bit signed integer.

GIN file versions 3.32+:

Normally if the underlying value does not map to a value in the enumeration definition, then the Calibration software will display “-”. It is possible to define this ‘default’ text by including “?” in one of the value entries or as its own entry:

1;[ENUM=A,0,OFF,1,ON,2?,UNDEFINED]
2;[ENUM=B,0,OFF,1,ON,2,MAYBE,?,UNDEFINED]