Next: Wrapping a C Pointer Type, Previous: Wrapping a C Constant, Up: G-Wrap's High-level API [Contents][Index]
When wrapping a whole C enumerate type, G-Wrap proposes an interface
which is more convenient than wrap-constant!
(see Wrapping a C Constant).
Add the enumerate values defined by args to the list of constants to be wrapped by wrapset. The arguments in args must contain the following named parameters:
#:name
a symbol that is the name for this wrapped type as used within the G-Wrap framework;
#:c-type-name
a string that is the C name of this enumerate type;
#:values
a list of symbol/string pairs defining the mapping between C values
and their counterpart in the target language; each pair’s car
is a symbol representing the name for this value in the target
language; each pair’s cdr
is a string representing this value
in C;
#:description
an optional description of this enumerate type.
This can be used as follows:
(wrap-enum! my-wrapset #:name 'errcode #:c-type-name "errcode_t" #:description "The libchbouib error codes." #:values '((chbouib/no-memory . "ERR_NO_MEM") (chbouib/not-found . "ERR_NOT_FOUND") (chbouib/invalid . "ERR_INVALID")))