[cffi-devel] Re: AW: defenum proposal

Luís Oliveira luismbo at gmail.com
Mon Jan 23 13:57:39 UTC 2006


"Hoehle, Joerg-Cyril" <Joerg-Cyril.Hoehle at 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_002dvalue.html


> 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

-- 
Luís Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt




More information about the cffi-devel mailing list