Groveler and HUGE_VAL

Stelian Ionescu sionescu at cddr.org
Fri Apr 26 17:24:30 UTC 2013


On Fri, 2013-04-26 at 08:40 -0600, Zach wrote:
> Thanks Martin, that's just what I'll do.
> However, isn't the entire point of a groveler to build a little C
> program that gathers information like this for later use?

The groveler can only deal with compile-time constants. What Martin
means, I suppose, is that HUGE_VAL could be defined as a function call
to a compiler intrinsic, for instance. See
http://cvsweb.netbsd.org/bsdweb.cgi/src/include/math.h?rev=1.62


> If one were to write a general purpose way to do this, wouldn't the
> logical place to put that code be in cffi-groveler?

To do what exactly ?


> Is the main hurdle here the fact that HUGE_VAL doesn't necessarily
> have a representation as a Lisp integer or double-float, the only two
> types that cvar allows?

That too is an issue. There's another ASDF component in cffi-grovel,
named wrapper-file, that can help with automatically generating a shared
library that contains functions that wrap values which cannot be
portably grovelled, so your best choice might be to generate a wrapper
that returns an uint64_t which you then pass to
nlopt_set_lower_bounds(), completely avoiding the use of Lisp floats.

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

-------------- 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/20130426/430a94d5/attachment.sig>


More information about the cffi-devel mailing list