Enumeration types - Factor Documentation (original) (raw)
Enumeration types
Factor handbook » C library interface » Passing data between Factor and C
Prev: | Byte arrays and the garbage collector |
---|---|
Next: | Alien destructors |
The alien.enums vocab contains the implementation for ENUM: C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum.
Defining enums at run-time: define-enum ( word base-type members -- )
Conversions between enums and integers: enum>number ( enum -- number )
number>enum ( enum-c-type -- quot )