passing constants as "textual literals" to foreign-lambdas?

Al <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <[email protected]>
Suppose that there is a C function

int result;
void compute( int x, int y /* several more */) {
   result = /* some complex computations */ ;
}

I could get a hold of "result" using foreign-value, and I could declare 
"compute" as a foreign-lambda. If I wanted to pass the constants x=3, 
y=4 (plus some other variables) to compute(), csc would C_fix() the 
constants then C_unfix() them to pass them to the "foreign lambda".

Is there any way to avoid the C_fix() / C_unfix() spiel and pass 
constant values directly as textual literals to compute() -- more 
exactly, to csc which in turn outputs the compute() calls in the 
generated .c file?

Specifically, I have some offsets into a vector that are computed via 
macros. The offsets vary between different invocations of the macros, 
but are known at compile time. compute(), called from the macros, 
operates on the vector at the given offsets (plus a variable 
base-index). I would like to pass those constant offsets directly, 
without generating useless (and slow) code to fix() / unfix() them.

The one work-around I can think of is to write an er-transformer macro 
to generate strings for foreign-primitive / foreign-lambda* 
specializations of compute() with certain constant args. This doesn't 
seem so nice though.


Thanks,
Al
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.