Hi!

Do not know what library is always available so you can try the
example. Meanwhile here is an example based on gnu scientific library

Code for the binding is saved to file gsl.fs:

Module GSL

DOS

library libgslcblas libgslcblas.so
library libgsl libgsl.so.0 depends libgslcblas

legacy off

libgsl gsl_matrix_alloc int int (int) gsl_matrix_alloc 
( n m -- *gsl_matrix )
libgsl gsl_matrix_calloc int int (int) gsl_matrix_calloc 
( n m -- *gsl_matrix )
libgsl gsl_matrix_free int (void) gsl_matrix_free 
( *gsl_matrix -- )
libgsl gsl_matrix_get int int int (fp) gsl_matrix_get
( *gsl_matrix i j  -- df )
\ ******* this is the function that gives trouble **********
libgsl gsl_matrix_set int int int df (void/fp) gsl_matrix_set 
( df *gsl_matrix i j  -- )

legacy on
previous
Module;

Function gsl_matrix_set has the following definition
void gsl_matrix_set (gsl_matrix * m, size_t i, size_t j, double x )

Now I start bigforth and do the following sequence:

include gsl.fs  ok
also gsl  ok
3 3 gsl_matrix_calloc   ok
value a[[  ok
a[[ 0 0 1e0 gsl_matrix_set   Bus Error ! gsl_matrix_set

Please note, that parameter list order of the definition of
gsl_matrix_set in my gsl module follows the order of original
c-function. Now I move df parameter to the front of the list in gsl.fs
file like that:

libgsl gsl_matrix_set df int int int (void/fp) gsl_matrix_set 
( df *gsl_matrix i j  -- )

then I get at the prompt:

include gsl.fs  ok
also gsl  ok
3 3 gsl_matrix_calloc  ok
value a[[  ok
a[[ 0 0 1e0 gsl_matrix_set  ok
also float  ok
a[[ 0 0 gsl_matrix_get   ok
f. 1.  ok

This is already strange, since I defined the parameter order
differently than the original definition. If I change the order of
ints in my calling sequence gsl aborts.

Now keeping the same definition with the floating parameter in front
instead at its designated place and start bigforth again:


include gsl1.fs also gsl1  ok 
3 3 gsl_matrix_calloc value a[[  ok
0e0 a[[ 0 0 1e0 gsl_matrix_set  Bus Error ! gsl_matrix_set 
also float  ok
a[[ 0 0 gsl_matrix_get   ok
f.s 1  ok
fdrop ok
0e0 a[[ 0 0 13e1 gsl_matrix_set  Bus Error ! gsl_matrix_set 
a[[ 0 0 gsl_matrix_get   ok    
f. 130.  ok

Note that though an error happens when something else is on the
f-stack the to floating number gets written where it should.

Also I have troubles when there are 2 df parameters for a procedure.

It would be very helpful it the error can be fixed. Your help is
appreciated.

--
Sergey

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to