Groveller malforms ioctl requests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
New
|
Undecided
|
Stelian Ionescu |
Bug Description
On Thu, Jan 28, 2010 at 2:42 PM, Vitaly Mayatskikh <email address hidden> wrote:
> ioctl() requires `request' parameter to be of type `int'. CFFI
> processes constants as they are of type (u)int64_t. This malforms some
> requests, for example Video4Linux2 VIDIOC_* requests.
>
> This patch adds type :int to constant groveller to solve such
> problems.
>
> --- grovel/grovel.lisp~ 2009-06-16 18:20:08.000000000 +0200
> +++ grovel/grovel.lisp 2009-12-21 12:15:14.612484158 +0100
> @@ -468,6 +468,8 @@ char* print_double_
> (c-print-symbol out lisp-name t)
> (c-format out " ")
> (ecase type
> + (:int
> + (format out "~& fprintf(output, \"%i\", (int32_t) ~A);" c-name))
> (integer
> (format out "~& if(SIGNED64P(
> (format out " fprintf(output, \"%lli\", (int64_t) ~A);" c-name)
>
On Fri, Apr 30, 2010 at 9:13 PM, Stelian Ionescu <email address hidden> wrote:
> The auto-detection of a macro's type doesn't work for values whose
> integer-length is 64. My options are two: either I require the user to
> specify the type, or I switch the groveler to C++ : iostream is
> polymorphic so cout << CONSTANT will do the right thing. My preference
> goes to C++, what do you think ?
I'm leaning towards optionally letting the user specify the type. Is that possible?