[cffi-devel] Re: defenum proposal

Frank Buss fb at frank-buss.de
Tue Jan 24 05:09:39 UTC 2006


Luís Oliveira wrote:

> (defcenum event
>    :no-event
>    :active-event
>    :key-down
>    :key-up)
> 
> (defmacro define-event-mask (name keyword)
>    `(defconstant ,name (ash 1 (foreign-enum-value 'event ',keyword))))
> 
> (define-event-mask +active-event-mask+ :active-event)
> (define-event-mask +key-down-mask+     :key-down)
> (define-event-mask +key-up-mask+       :key-up)

ok, this is a good translation, if you do it by hand. My problem is that I
want to automate it with SWIG or Verrazano, without the need to do manual
editing of the generated bindings, and this frameworks can't invent the
named enum "event", because it is an anonymous enum in the header source.

-- 
Frank Buss, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de




More information about the cffi-devel mailing list