Skip to content

gmplEnumerationStatement

Enumeration is a terminal or nonterminal declaration statement that occurs in reference scripts. It is also a metalanguage statement that is used to define not only enumerations in the source language, VB6, but also enumerations in the gmBasic languages themselves. An Enumeration is an identified set of (identifier, value) pairs. Each identifier in the Enumeration must be unique within the set. Each value in the Enumeration must be of the same type, but need not be unique. The value type can be any type including string and another enumeration. Each pair within the enumeration is referred to as an entry. Enumerations appear in both library and language descriptions; therefore, they also support all of the various migration attributes that can be associated with such components.

The terminal form of the Enumeration statement is used to deal with the forward reference problems in library declarations. It is often the case that a component in one class references another type defining component that has not yet been defined. Rather than trying to sort the definitions into a “reference” order, gmBasic, when it authors the declarations, adds a set of terminal Enumeration statements to the front of the library declaration with only the Id attribute specified. The later Enumeration statement with the same Id then specifies the remaining attributes and substatements.

The attributes of the Enumeration statement are as follows:

AttributeDescription
IdThe identifier of the enumeration used to contain its entries. It is stored in the scope
of the containing component, unless that component is a class. See the private
attribute below.
MigNameIf the enumeration is to appear in authored code then this attribute specifies the name to be used
for it in that code.
MigStatusThis attribute is a MigStatus attribute as discussed on the Declaration page. It
contains generalized migration settings for the component.
TypeThis attribute specifies the type of the entry values. It may be integer, string,
or another enumeration. If omitted, then the type is assumed to be integer.
PrivateThis attribute is only relevant to enumerations within classes. If this attribute is On
then the parent is the class. If this attribute is Off or omitted, then the parent is the
library.
StructureThis identifier attribute is used in metalanguage contexts in which enumerations can specify values
to be associated with particular fields within a storage structure. This attribute contains the
identifier of this structure.

The substatements within the Enumeration statement are as follows:

SubstatementDescription
EntryDefines one of the identifier, value pairs in the enumeration.

The script errors associated with the Enumeration statement are as follows:

ErrorDescription
1111Enumeration command missing required id attribute.
1112Unable to store ENUMERATION vector: %1d
1113Unable to find bridged ENUMERATION: %1d
1114Unable to find structure for ENUMERATION: %1d
1115Encountered following when expecting ‘entry’: %1d


Entry is a terminal substatement of the Enumeration statement. It defines an identifier value pair within the enumeration. The attributes of the Entry substatement are as follows:

AttributeDescription
IdThis attribute is the identifier of the entry within the enumeration. It must be unique in that
scope. It is not case sensitive.
valueThis attribute contains that value to be associated the entry. It must be of the type specified
by the type attribute for the enumeration.
MigNameIf the enumeration entry is to appear in authored code then this attribute specifies the name
to be used for this entry in that code.
MigStatusThis attribute is a MigStatus attribute as discussed on the Declaration page. It
contains generalized migration settings for the component.
RoleThis attribute contains an optional keyword describing the overall role of the class: Unknown,
Property, Method, Define, Utility, Command, Constant,
Function, Event, Control, Collection, Resource, Index, or
Migclass. The default is None.
DescriptionThis attribute entry can be used to document the entry. It is not used by gmBasic.
OpcodeThis attribute is only used with metalanguage declarations. If the enumeration describes low
level types within the user language, then this entry specifies the actual opcode.subcode
byte pair to be issued by references to the entry.
MigPatternThis string attribute associates a surface pattern string with code references to the entry. See
the Patterns page for details on the content of pattern strings. It is equivalent to the All
pattern.
CshPatternThis string attribute associates a surface pattern string with code references to the entry. See
the Patterns page for details on the content of pattern strings. It is equivalent to the Csh
pattern.
VbnPatternThis string attribute associates a surface pattern string with code references to the entry. See
the Patterns page for details on the content of pattern strings. It is equivalent to the Vbn
pattern.
NpramThis integer attribute specifies the number of parameters associated with the surface pattern strings.
SubcodeThis attribute is only used with metalanguage declarations in which the parent enumeration has a
structure specified. This attribute then specifies which field in the structure this entry
relates to.

The script errors associated with the Entry substatement are as follows:

ErrorDescription
1116Enumeration entry missing required id attribute.
1117Unable to store [%1d] as an enumeration entry.
1118Bridge entry [%1d] cannot be found.
1119The opcode cannot be found.
1120Structure member entry [%1d] cannot be found.