[cffi-devel] cffi-grovel malforms ioctl requests

Vitaly Mayatskikh v.mayatskih at gmail.com
Thu Jan 28 13:42:01 UTC 2010


Hi!

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_for_lisp(double n)
     (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(~A))~%" c-name)
        (format out "    fprintf(output, \"%lli\", (int64_t) ~A);" c-name)

-- 
wbr, Vitaly




More information about the cffi-devel mailing list