ENUM
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
[access] ENUM name member_def [, value] . . . ENDENUM
Arguments
access
(optional) One of the following access modifiers:
Access is not restricted. This is the most accessible option. (default for Synergy .NET)
Access is limited to the containing class or types derived from the containing class. (traditional Synergy only)
Access is limited to the containing type. This is the least accessible option. (default) (traditional Synergy only)
Access is limited to the current assembly. (Synergy .NET only)
name
The name of the enumeration to define.
member_def
The name of the member. You can specify as many member definitions as you want, although you must specify at least one.
value
(optional) The value of the member.
Discussion
The ENUM statement enables you to declare one or more enumerations globally or within a class or namespace. You can declare one or more enumeration values within an enumeration by declaring a unique identifier for each value. If the identifier is not unique within the enumeration, a “Symbol already uniquely defined” error (TOKUDF) is generated.
If the starting enumeration value does not have an explicit integer value, the compiler assumes the integer value to be 0. For any subsequent field without an explicit integer value, the compiler assumes its integer value to be one more than the previous enumeration value’s integer value.
For example:
enum myenum f0 ;Assumed to be 0 f1 ;Assumed to be 1 f2 ,7 f3 ;Assumed to be 8 f4 ;Assumed to be 9 f5 ,3 f6 ;Assumed to be 4 endenum
Specifying duplicate integer values within an enumeration is valid. For example, the following is allowed:
enum SystemState off ,0 down ,0
If an enumeration inside a namespace or class hides a global enumeration, a level 4 “Enum_name enumeration hides global enumeration of same name” warning is generated, where enum_name is the name of the enumeration.
If member_def is one of the following reserved keywords, a comma is required after member_def whether value is specified or not: end, endclass, endenum, endexternal, endfunc, endfunction, endglobal, endliteral, endmain, endname, endnamespace, endparams, endrecord, endsub, endsubroutine, global, main, proc, start, record, common, literal. For example:
enum myenum value1 ,10 main , start ,10 record , endenum
See also
enumeration data type
Examples
import System.Collections enum SearchMode All, 1 Selected, 2 endenum main EnumTest record Results, @ArrayList endrecord proc SearchForSomething(SearchMode.All,,Results) stop endmain 1 2 subroutine SearchForSomething required in SearchType ,SearchMode optional in Filter ,a required out Results ,@ArrayList endparams proc using SearchType select (SearchMode.All), . ;Code to return ALL in Results goes here . . nop (SearchMode.Selected), . ;Code to return SELECTED in Results goes here . . nop endusing xreturn endsubroutine