[Cffi-devel] cffi-grovel bitfield

Frank fau at riseup.net
Mon Jan 26 02:01:51 UTC 2015


Hello,
Thanks for your reply.  Atm I work around this so I'm good.  I may pick
up on that and have a closer look and get back on this later.

On Sun, 2015-01-25 at 23:06 +0000, Luís Oliveira wrote:
> Hello Frank,
> 
> On Sat, Jan 17, 2015 at 9:27 AM, Frank <fau at riseup.net> wrote:
> > enum uv_tcp_flags {
> >   /* Used with uv_tcp_bind, when an IPv6 address is used. */
> >   UV_TCP_IPV6ONLY = 1
> > };
> [...]
> > #ifdef UV_TCP_IPV6ONLY
> > fprintf(output, "%d", UV_TCP_IPV6ONLY);
> > #else
> > fputs("\n  #.(cl:progn (cl:warn 'cffi-grovel:missing-definition :name
> > 'IPV6-ONLY) -1)", output);
> > #endif
> > fputs(")", output);
> > fputs(")\n", output);
> >
> > Obviously the #ifdef guard is the culprit here.  Maybe you guys want to
> > fix this?
> 
> Well, there's a purpose to that #ifdef, and it works nicely when
> dealing with macro constants rather than enums.
> 
> I'm not sure what the best way is to cater to your use case. We have
> CENUM and CONSTANTENUM for CFFI:DEFCFENUM, but only BITFIELD for
> CFFI:DEFBITFIELD. The naming is a bit inconsistent.
> 
> But naming aside, do you feel like adding (and testing) an option to
> CFFI:DEFBITFIELD that does what you want? A pull request on GitHub
> would be great!
> 
> Thanks,
> 






More information about the cffi-devel mailing list