[cffi-devel] Re: defenum proposal
Hoehle, Joerg-Cyril
Joerg-Cyril.Hoehle at t-systems.com
Mon Jan 23 17:22:19 UTC 2006
Luis Oliveira writes:
>With FOREIGN-ENUM-VALUE, see
>http://common-lisp.net/project/cffi/manual/html_node/foreign_002denum_002dvalue.html
>Right, that's what CFFI has, see
>http://common-lisp.net/project/cffi/manual/html_node/defcenum.html
Thanks for pointing me to the CFFI enum stuff. I forgot that the converters already convert to a symbol, so indeed, the SWITCH is superfluous.
BTW, w.r.t. to the CFFI enum API, it's ok to use keywords, not other symbols, since the functions all take a "context" parameter, i.e. the enum type. So the keyword is always relative to the type.
The manual does not say what happens
a) when multiple enum identifier want to map to the same int.
b) how foreign-enum-keyword behaves in this case.
I've come across a few .h files which had that, can't remember where.
>(case (sdl:get-event-type ...) ; or whatever
> (:keyboard ...)
> (:mouse ...))
Very, very nice! The best I've encountered.
Regards,
Jörg Höhle.
More information about the cffi-devel
mailing list