groveller's :define-constants doesn't work with cenum
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I tried to use the cffi groveller to create a binding for <linux/videodev2.h>
The following definition:
(cenum (v4l2_buf_type :define-constants t) ((:capture "V4L2_BUF_
leads to this code in the auto-generated C-file:
/* constant section for CAPTURE */
#ifdef V4L2_BUF_
fputs(
fputs("capture", output);
fputs(" ", output);
if(_64_
fprintf(output, "%lli", (int64_t) V4L2_BUF_
else
fprintf(output, "%llu", (uint64_t) V4L2_BUF_
fputs(")\n", output);
#else
fputs("(cl:warn 'cffi-grovel:
#endif
The V4L2_BUF_
Therefore, the #ifdef is undefined and the processed grovel file just contains the line
(cl:warn 'cffi-grovel:
instead of the expected constant definition.
I use cffi_0.11.2 and SBCL 1.1.14.30-ba008a7 on x86_64 GNU/Linux.
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in cffi: | |
status: | New → Confirmed |
[cc'ing Stelian Ionescu]
On Thu, Jan 23, 2014 at 5:37 PM, Martin Kielhorn TYPE_VIDEO_ CAPTURE" ))) TYPE_VIDEO_ CAPTURE
<email address hidden> wrote:
> (cenum (v4l2_buf_type :define-constants t) ((:capture
> "V4L2_BUF_
[...]
> /* constant section for CAPTURE */
> #ifdef V4L2_BUF_
Stelian: git-blame says you implemented the :DEFINE-CONSTANTS option
for CENUM. The implementation delegates the work to the CONSTANT
grovel form but that shouldn't work because the C preprocessor doesn't
know about enums. Did that ever work?