Subject: [clisp-list] RE: FFI with complex numbers?

From: "Goffioul Michael" <[email-masked]>
Date: Wed May 12 08:07:05 2004

> > I'm a little bit lost among all the answers that requires more and
> > more knowledge of CLISP internals (which I don't have).
> 
> start with little pieces... :-)

I'd like to, but I don't have much time (it's not a hobby, it's for
my work) and the module interface is completely undocumented.

> completely untested:
> 
> DEFUN(fun,arr) {
>   uintL pos, index, size = array_total_size(STACK_0 = 
> check_array(STACK_0));
>   object data_vector = array_displace_check(STACK_0,size,&index);
>   double *c_array = alloca(size*sizeof(double));
>   pushSTACK(data_vector);
>   for (pos=0; pos<size; pos++)
>     c_array[pos] = to_double(TheSvector(STACK_0)->data[pos+index]);
>   begin_system_call();
>   func(c_array,size);
>   end_system_call();
>   for (pos=0; pos<size; pos++)
>     TheSvector(STACK_0)->data[pos+index] = 
> c_double_to_DF(&c_array[pos]);
>   VALUES1(STACK_1); /* return the argument */
>   skipSTACK(2);
> }

That's already something I can start with. Thanks. Just one question:
is it possible to replace the "for" loops by "memcpy"-like calls, for
efficiency (looking at your code, I guess the answer is "no", but you
never know...)?

Michael.

---

From: Sam Steingold <[email-masked]>
Date: Wed May 12 08:35:02 2004

> * Goffioul Michael <[email-masked]> [2004-05-12 17:03:46 +0200]:
>
> I'd like to, but I don't have much time (it's not a hobby, it's for my
> work) and the module interface is completely undocumented.

Did you look here: <http://clisp.cons.org/impnotes/modules.html>?
If you did, I don't see how you can call it "undocumented".
If you did not, you might want to say "I cannot find the documentation"
instead of "undocumented" next time.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Hard work has a future payoff.  Laziness pays off NOW.