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
How does this work with anonymous enums? E.g. like this (C code) :
enum { SDL_NOEVENT = 0, SDL_ACTIVEEVENT, SDL_KEYDOWN, SDL_KEYUP, }; #define SDL_EVENTMASK(X) (1<<(X)) enum { SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), };
setEventMask(SDL_ACTIVEEVENTMASK | SDL_KEYUPMASK);
How would you translate this to Lisp with CFFI? With my def-anon-emum macro, which translates just to defconstant, it would be easy, but perhaps there are better ways to do it.