[PPL-devel] Re: Communicating bignums to/from the C interface
Vitor Santos Costa
vitor at biostat.wisc.edu
Fri May 14 19:19:19 CEST 2004
Hi Roberto
Sorry for the long delay in answering, been a bit busy with another
visit to Wisconsin.
> we now need to communicate bignums to and from the C interface.
> I didn't find provision for this in the current interface.
> What is needed is
>
I changed the interface to support bignums. Please check the CVS (and
please do report any bugs).
> 1) a predicate to test whether a YAP integer would fit into a long
> int so that IntOfTerm() can be used;
>
The interface I wrote now separates integers from bignums, so you
should just use YAP_IsIntTerm vs YAP_IsBigNumTerm. Is that ok for you?
> 2) a sort of NumberCharsOfTerm() to get a char* containing the number
> chars corresponding to a (possibly big) YAP integer;
>
You mean like writing a term to a string? I suppose it does make sense
now that I have YAP_ReadBuffer to also have YAP_WriteBuffer. I'll
include that next. Right now, you'd have to use YAP_BigIntFromTerm and
then use the GMP routine to send it out on a string.
> 3) a sort of MkIntFromNumberChars to create a YAP integer out of a char*
> containing number chars.
>
The interface now has YAP_ReadBuffer which will do that.
> It would be nice to have these or other equivalent facilities in YAP.
> What do you think?
I do agree, sorry for the delay!
Cheers,
Vitor
PS: Ricardo, you may want to consider including this functionality in
4.4.
More information about the PPL-devel
mailing list