> > 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.

-- 
Frank Buss, [EMAIL PROTECTED]
http://www.frank-buss.de, http://www.it4-systems.de

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to