define-c-enum name-and-options &rest enumerator-list => list
name-and-options ::= name | ( name option *)
option ::= (:foreign-name string )
enumerator-list ::= { entry-name | ( entry-name entry-value )}*
A symbol naming the new enumeration type specifier
A string specifying the foreign name of the type
A sequence of symbols, possibly with index values, constituting the enumerator type
A symbol
An index value for an entry-name
The macro
define-c-enum
is used to define a FLI enumerator type specifier, which corresponds to the C
enum
type. It is a convenience function, as an enumerator type could also be defined using define-foreign-type.
Each entry in the enumerator-list can either consist of a symbol, in which case the first entry has an index value of 0, or of a list of a symbol and its corresponding index value.
In the following example a FLI enumerator type specifier is defined, and the corresponding definition for a C enumerator type follows.
(define-c-enum colors red green blue)
enum colors { red, green, blue};
The next example illustrates how to start the enumerator index list counting from 1, instead of from the default value of 0.
(define-c-enum half_year (jan 1) feb mar apr may jun)
enum half_year { jan = 1, feb, mar, apr, may, jun }