slang-users mailing list

[2000 Date Index] [2000 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: foreign references and operator overloading


Dave Greve <dagreve@xxxxxxxxx> wrote:
>  1) I don't want to expose the entrails of the QDD
>     data structure to the s-lang user.  Rather, the
>     user will see "references" to QDD objects which
>     can be passed around, stored in s-lang variables,
>     and manipulated using intrinsic functions.  However,

I recommend that you look at slstdio.c to see how File_Type objects
have been implemented.

>  2) I might want to add multi-precision arithmetic
>     to my interpreter (probably using GMP).  Again,
>     I don't want the s-lang user to know what a
>     bignum looks like, but I want to be able to

This is going to be trickier and the optimal solution will have to
wait for slang v2.0.  Currently there is no way to have bignum
literals without hacking the slang source.  The best you can do with
the existing form of the library is to create some function, say
bignum, that returns a bignum object, e.g.,

     x = bignum ("123456789012345678901234567");

In version 2.x, you will be able to use

     x = 123456789012345678901234567B;

  (Note the `B' suffix, which will indicate a bignum.)

Once you have created the bignum object, you can define binary
operations between it and the other integers.  See
slang/src/slcmplex.c for an example of the technique.

Good luck,
--John


[2000 date index] [2000 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]