[cffi-devel] Grovel float constants

Stelian Ionescu stelian.ionescu-zeus at poste.it
Mon May 25 22:27:31 UTC 2009


On Mon, 2009-05-25 at 17:21 -0400, Liam Healy wrote:
> I am trying to use cffi-grovel on GSL's physical constants.
> For example, in
> http://git.savannah.gnu.org/cgit/gsl.git/tree/const/gsl_const_mksa.h,
> these are defined:
> #define GSL_CONST_MKSA_SPEED_OF_LIGHT (2.99792458e8) /* m / s */
> #define GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */
> 
> When I try to define these using CFFI-grovel
> (constant (+mksa-speed-of-light+ "GSL_CONST_MKSA_SPEED_OF_LIGHT"))
> I end up with an integer, because the C definition is cast to an
> integer prior to generating the
> constant.
> 
> Is there a way to get around this, so that I can grovel float constants?

not at the moment. you would need to modify the CONSTANT directive(add
a :type key arg that defaults to :int). patches accepted, otherwise I'll
try to do it myself this weekend or next week

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20090526/7b0cf28f/attachment.sig>


More information about the cffi-devel mailing list