SPRU513Y August 2001 – June 2022 SM320F28335-EP
The following directives support a pseudo-scoping for enumerations:
ENUM_NAME | .enum |
MEMBER1 | .emember [value] |
MEMBER2 | .emember [value] |
... | |
.endenum |
The .enum directive begins the enumeration definition and .endenum terminates it.
The enumeration name (ENUM_NAME) cannot be used to allocate space; its size is reported as zero.
To use a member's value, the format is ENUM_NAME.MEMBER, similar to using a structure member.
The .emember directive optionally accepts the value to set the member to, just as in C/C++. If not specified, the member takes a value one more than the previous member. As in C/C++, member names cannot be duplicated, although values can be. Unless specified with .emember, the first enumeration member will be given the value 0 (zero), as in C/C++.
The .endenum directive cannot be used with a label, as structure .endstruct directives can, because the .endenum directive has no value like the .endstruct does (containing the size of the structure).
Conditional compilation directives (.if/.else/.elseif/.endif) are the only other non-enumeration code allowed within the .enum/.endenum sequence.