[PPL-devel] Re: Bignums and the foreign language interface

Roberto Bagnara bagnara at cs.unipr.it
Tue Jan 7 17:15:40 CET 2003


Manuel Carro wrote:
>     Hi Roberto (and all) -- have a happy new year!

You too!

>     Completely agreed.  I have implemented your suggestion, with some
> slight rewording and an extra function:
> 
> /* Check size */
> ciao_bool ciao_fits_in_int(ciao_term term);
> 
> /* Try to perform conversion and return a success/failure code */
> ciao_bool ciao_to_integer_check(ciao_term term, int *res);

Are these in addition to the old, unchecked

   ciao_term ciao_integer(int i)

?

If so, I believe `ciao_to_integer_check(ciao_term term, int *res)'
is redundant.  I mean:

1) when the user _knows_ that the number fits, he/she can
    use `ciao_integer(int i)' for maximum speed;
2) when the user is not sure, he/she can use
    `ciao_fits_in_int(ciao_term term)' to cook his/her one
    checked version.

Another curiosity is: why `int' instead of `long' (the widest,
standard integral type)?

> /* Make conversion between arbitrary numbers and strings */
> char     *ciao_get_number_chars(ciao_term term);
> ciao_term ciao_put_number_chars(char *number_string);

If, as I suppose, the char* obtained with
`ciao_get_number_chars(ciao_term term)' is under the responsibility
of the Prolog engine, its lifetime should be documented.

> I can send you the modified files or leave a complete .tgz for you to
> download; whatever you prefer.

If this is not too much, I would prefer obtaining a development snapshot
of Ciao.  I still have problems with the foreign language interface
and I hope they are caused by bugs you have already fixed ;-)
All the best

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it




More information about the PPL-devel mailing list