chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Importing alien bignums


From: Kon Lovett
Subject: Re: [Chicken-users] Importing alien bignums
Date: Tue, 13 Jun 2006 09:08:16 -0700

On Jun 13, 2006, at 8:05 AM, John Cowan wrote:

My Q-language egg is coming along nicely, and I've run into an issue with bignums vs. FFI. When the numbers egg is installed, Chicken represents
bignums as mpz_t objects from the GMP.  Q has bignums as standard,
and uses the same representation and library.

However, there is not surprisingly no support for bignums in the FFI.
How can I persuade Chicken to treat a c-pointer coming from the FFI as an (mpz_t *) and consider it to be a Scheme number? (Obviously this would
only be done if the full-numeric-tower: feature is available.)

Naturally, bignums have to be copied both ways so that the two garbage
collectors don't collide.

The interface the numbers egg uses isn't public. You would want to use 'alloc_bignum*', etc. routines. In the short term maybe just copy- and-paste the 'numbers-c.[ch]' stuff. Then coerce the types in your bridge explicitly.

But, yeah, something must be done for better integration of the full- numeric-tower.

Q is pretty neat. Good luck.

Kon


--
Take two turkeys, one goose, four               John Cowan
cabbages, but no duck, and mix them http://www.ccil.org/ ~cowan
together. After one taste, you'll duck          address@hidden
soup the rest of your life.
        --Groucho


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]