intex11c.c

Go to the documentation of this file.
00001 #include "stack-c.h"
00002 
00003 /**************************************************
00004  * Executing the Scilab function "myfct" defined in ex11c.sce
00005  **************************************************/
00006 
00007 int intex11c(fname) 
00008      char *fname;
00009 {
00010   int mlhs,mrhs,ibegin;
00011   static int l1, m1, n1, m2, n2, l2 ;
00012   static int minlhs=1, minrhs=6, maxlhs=3, maxrhs=6;
00013   static char name[] = "myfct" ;
00014 
00015   CheckRhs(minrhs,maxrhs) ;
00016   CheckLhs(minlhs,maxlhs) ;
00017 
00018   GetRhsVar(1, "d", &m1, &n1, &l1);
00019   GetRhsVar(2, "d", &m2, &n2, &l2);
00020   GetRhsVar(3, "d", &m2, &n2, &l2);
00021   GetRhsVar(4, "d", &m2, &n2, &l2);
00022   GetRhsVar(5, "d", &m2, &n2, &l2);
00023   GetRhsVar(6, "d", &m2, &n2, &l2);
00024 
00025   /* 
00026    *  We receive 6 input variables indexed by (1,2,...6) 
00027    *  when the command ex11c(x1,x2,x3,x4,x5,x6) is issued.
00028    *  We have a Scilab function "myfct" with mrhs=2 inputs 
00029    *  and mlhs=3 outputs:
00030    *  function [u,v,w]=myfct(x,y)','u=7+x,v=8+y,w=9+y')
00031    *  To run myfct with input variables x5 and x6,
00032    *  we must set ibegin=5. Variables passed to the function must
00033    *  appear consecutively with index ifirst, ifirst+1,..., ifirst+mrhs. 
00034    */
00035   ibegin=5;  mlhs=3; mrhs=2 ; 
00036   /* execute the function "myfct" */
00037   SciString(&ibegin,name,&mlhs,&mrhs);
00038 
00039   /* check if an error has occured while running a_function */
00040   if (Err > 0 ) return 0;
00041   
00042   /* Output variables u, v, and w of myfct
00043    * are now indexed by ifirst, ifirst+1, ifirst+mlhs i.e.
00044    * u and v are indexed by 5 and 6 resp. and w (created by myfct)
00045    * is indexed by 7.
00046    * We return u v and w:
00047    * Caution: Variables with index larger than ifirst+mrhs cannot be 
00048    *  returned to Scilab.
00049    */
00050 
00051   LhsVar(1) = 5;
00052   LhsVar(2) = 6;
00053   LhsVar(3) = 7;
00054   return 0;
00055 }
00056 
00057 
00058 
00059 

Generated on Sun Mar 4 15:03:57 2007 for Scilab [trunk] by  doxygen 1.5.1