At 3:57 Uhr +0730 31.12.2005, TJay wrote:
How do I create a scheme list inside a C function, and return that list? I couldn't find any documentation on this, so I searched through gambit.h and came up with this, which fails to compile due to "___hp" being "undeclared".
I've failed to do things like this as well, due to missing knowledge about those details. (In my gambit->perl interface, I had to use "trampoline" functions to be able to allocate `values' tuples, which is nasty since I had to generate one for each of the possible lengths, alas I limited the possible lengths to 0..10 to be practical, and am waiting for a better way to do this.)
Gambit-compiled functions do set up such variables in their code. I guess that ___hp might stand for "heap pointer" and for some reason (possibly using multiple gambit systems in one program binary?) it is not a global.
Marc: can you give more info? Which parts of the Gambit source do you recommend to try to understand first?
___S8 one, two, three; one = 1; two = 2; three = 3;
return ___CONS(one, ___CONS(two, ___CONS(three, ___NUL)));
Note that you would also have to convert the ___S8 values to ___SCMOBJ, using ___FIX() probably.
(read) ;So that I can enter the REPL by interrupting the program.
Maybe you would like to use (##repl) instead.
Christian.