fort(1)

NAME
fort - fortran or C user routines call

CALLING SEQUENCE
[y1,...,yk]=fort("ident",x1,px1,"tx1",...,xn,pxn,"txn",
                 "out",[ny1,my1],py1,"ty1",...,[nyl,myl],pyl,"tyl")
[y1,....,yk]=fort("ident",x1,...,xn)

PARAMETERS

"ident"
    : string

xi  : real matrix

pxi, pyi
    : integers

txi, tyi
    : character string "d", "r" or "i"

DESCRIPTION
Interactive call of Fortran (or C) user routine from Scilab. The routine must be previously linked with Scilab. This link may be done:

    -   with Scilab "link" command (incremental "soft" linking) during the Scilab session.(see link)

    -   by "hard" re-linking. Writing the routine call within Scilab routine "default/interf.f" and then re_linking all Scilab with the command make bin/scilex in main Scilab directory.

The meaning of each parameter is described now:

    "ident"
        is the name of the subroutine called.

    x1,...,xn
        are input variables sent to the routine,

    px1,...,pxn
        are the respective positions of these variables in the calling sequence of the routine and

    tx1,...,txn
        are their fortran types ("r","i", "d", for real, integer, double precision) (strings are treated as integers).

    "out"
        is a keyword used to separate input variables from output variables.

    [ny1, my1]
        are the size (# of rows and columns) of output variables and

    py1, ...
        are the positions of output variables (possibly equal to pxi ).

    "ty1", ...
        are the fortran types of output variables. The k first output variables are put in y1,..., yk.

If an output variable coincides with an input variable (i.e. pyi=pxj ) one can pass only its position pyi . The size and type of yi are the same as those of xi .

In the case of short syntax , [y1,....,yk]=fort("ident",x1,...,xn), the txi, nyj, myj and tyj are then given in the routine interf (see the source code in the directory SCIDIR/default).

EXAMPLE
      subroutine foo(a,b,c)
      c=2*a+b
      end
      link("foo.o","foo")
      a=13;b=10;
      c=fort("foo",a,1,"r",b,2,"r","out",[1,1],3,"r")
returns the scalar (1x1 matrix) c=2*a+b with a=13 and b=10. a (resp. b,c ) is the first (resp. 2nd, 3rd) argument passed to foo . If your machine is a DEC Alpha, SUN Solaris or SGI you may have to change the previous command line link("foo.o","foo") by one of the followings :
link('foo.o -lfor -lm -lc','foo').
link('foo.o -lftn -lm -lc','foo').
link('foo.o -L/opt/SUNWspro/SC3.0/lib/lib77 -lm -lc','foo').

SEE ALSO
link, c_link, interf.f in SCIDIR/routines/default