[fetter-devel] unnamed bit fields

Luis Oliveira luismbo at gmail.com
Sat Sep 10 17:16:12 UTC 2005


On 10/set/2005, at 17:35, Andras Simon wrote:
> The following (from waistatus.h on Linux)
>
>     struct
>       {
>         unsigned int __w_termsig:7; /* Terminating signal.  */
>         unsigned int __w_coredump:1; /* Set if dumped core.  */
>         unsigned int __w_retcode:8; /* Return code if exited normally. 
>  */
>         unsigned int:16;
>       } __wait_terminated;
>
> (a member of a union) is translated to
>
> (cffi:defcstruct wait-anonymous338 (--w-termsig :unsigned-int)
>  (--w-coredump :unsigned-int) (--w-retcode :unsigned-int) ( 
> :unsigned-int))
>
> and causes
>
> error while parsing arguments to DESTRUCTURING-BIND:
>   invalid number of elements in
>     (:UNSIGNED-INT)
>   to satisfy lambda list
>     (CFFI::SLOTNAME TYPE &OPTIONAL (COUNT 1)):
>   between 2 and 3 expected, but 1 found
>    [Condition of type SB-KERNEL::ARG-COUNT-ERROR]
>
> in sbcl. I don't know how cffi expects bit-field definitions (or
> whether it supports them in the first place).

No, CFFI doesn't support bit-fields yet. But the problem there is that 
the last structure slot is nameless. I'd say you could generate 
bindings to PCRE without that header, but I might be wrong.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
Equipa Portuguesa do Translation Project
http://www2.iro.umontreal.ca/~pinard/po/registry.cgi?team=pt




More information about the fetter-devel mailing list