gmplEnumerationStatement

Enumeration Statement Summary

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:

Attribute Description
Id The 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.
MigName If the enumeration is to appear in authored code then this attribute specifies the name to be used for it in that code.
MigStatus This attribute is a MigStatus attribute as discussed on the Declaration page. It contains generalized migration settings for the component.
Type This 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.
Private This 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.
Structure This 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:

Substatement Description
Entry Defines one of the identifier, value pairs in the enumeration.

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

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


Entry Enumeration Substatement Summary

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:

Attribute Description
Id This attribute is the identifier of the entry within the enumeration. It must be unique in that scope. It is not case sensitive.
value This attribute contains that value to be associated the entry. It must be of the type specified by the type attribute for the enumeration.
MigName If the enumeration entry is to appear in authored code then this attribute specifies the name to be used for this entry in that code.
MigStatus This attribute is a MigStatus attribute as discussed on the Declaration page. It contains generalized migration settings for the component.
Role This 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.
Description This attribute entry can be used to document the entry. It is not used by gmBasic.
Opcode This 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.
MigPattern This 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.
CshPattern This 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.
VbnPattern This 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.
Npram This integer attribute specifies the number of parameters associated with the surface pattern strings.
Subcode This 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:

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


Table of Contents