Hello,
While building CFFI bindings for GLUT and using enums for defining bitfield masks, I came across this example:
(defcenum display-mode (:rgb 0) (:rgba 0) (:index 1) (:single 0) (:double 2) (:accum 4) (:alpha 8) (:depth 16) (:stencil 32) (:multisample 128) (:stereo 256) (:luminance 512))
defcenum won't accept this because it contains duplicate values. This a misfeature introduced by myself that I forgot to fix and people have complained[1] about this before. Unless someone has any objections, I'll implement something like what CLISP has.
But this makes me wonder if another abstraction, say DEFBITFIELD would be useful. Something like:
(defbitfield name (0 sym1 sym2 ...) (1 sym3) (2 sym4) ...)
Along with type translator on these types that would construct an integer from a list of these symbols and vice-versa. Any other suggestions before I push a patch with something like this?
BTW, I silently pushed a patch that adds a new option to defcenum by allowing a base-type (when the default, :int, is not appropriate).
[1] http://article.gmane.org/gmane.lisp.cffi.devel/26