[gambit-list] Passing heterogenous lists
ryu.alex at gmail.com
Fri Jan 30 00:52:55 EST 2009
I have written a C program calling scheme to evaluate logical and
arithmetical expressions. It seems to work okay for integers, but
floats have me at a loss. Short description of problem: I have a char
buffer of known length. I know that the first four bytes represent a
float, the second an int, the third an int, and so on. What I would
like to do is somehow get this data into the scheme part of my
program, preferably in a list form. One way is to use sprintf() to do
a crummy sort of conversion, put the results in a null-terminated
string, and use with-input-from-string (thanks to Marc for showing
me), but that is pretty unpleasant. Are there any better methods? I
was thinking about using vectors, but I can't see how that would work.
Thanks for your help
I suppose I could just pass all 120 arguments to eval_string and
list-replace? That seems pretty tedious. Here is more-or-less the
relevant part of what I have now
(c-define (eval-string str) (char-string) char-string "eval_string" "extern"
(lambda () (write-to-string (eval (list-replace from to
from is a list of tokens, to is a list of values.
More information about the Gambit-list