def-enum
— Defines a C enumeration.
Macro
def-enum
name fields &key separator-string
| A symbol that names the enumeration. |
| A list of field defintions. Each definition can be
a symbol or a list of two elements. Symbols get assigned a value of the
current counter which starts at |
| A string that governs the creation of constants. The
default is |
Declares a C enumeration. It generates constants with integer values for the elements of the enumeration. The symbols for the these constant
values are created by the concatenation
of the
enumeration name, separator-string, and field symbol. Also creates
a foreign type with the name name
of type
:int
.
(def-enum abc (:a :b :c)) ;; Creates constants abc#a (1), abc#b (2), abc#c (3) and defines ;; the foreign type "abc" to be :int (def-enum efoo (:e1 (:e2 10) :e3) :separator-string "-") ;; Creates constants efoo-e1 (1), efoo-e2 (10), efoo-e3 (11) and defines ;; the foreign type efoo to be :int