"Hoehle, Joerg-Cyril" Joerg-Cyril.Hoehle@t-systems.com writes:
I suppose defcenum shouldn't force the user to use keywords though?
Certainly not! Where would you get their value from if they are interned into the keyword package.
With FOREIGN-ENUM-VALUE, see http://common-lisp.net/project/cffi/manual/html_node/foreign_002denum_002dva...
BTW, I think a SWITCH macro would be a useful companion to ENUM. It's CASE where you can put such things into the selector clauses. Instead of (case event-type (#.SDL-keyboard-event[-enum] (do-this)) ... ... or (cond ((if (eql event-type SDL-keyboard-event[-enum]) ... ((if ... or (cond ((if (enum-eq? event-type SDL-keyboard-event) ...) ...
(case (sdl:get-event-type ...) ; or whatever (:keyboard ...) (:mouse ...))
I don't see the point of a SWITCH macro nor what it's supposed to do?
I'm not convinced DEFCONSTANT is appropriate. Maybe all is needed is a mapping from name to values (and vice-versa, the CLISP FFI has it),
Right, that's what CFFI has, see http://common-lisp.net/project/cffi/manual/html_node/defcenum.html