intex7c.c

Go to the documentation of this file.
00001 #include "stack-c.h"
00002 
00003 /**************************************************
00004  * An example of an hand written interface 
00005  * We call a scilab function (disp) inside the interface 
00006  **************************************************/
00007 
00008 int intex7c(fname) 
00009      char *fname;
00010 {
00011   int mlhs,mrhs,ibegin;
00012   static int l1, m1, n1, m2, n2, l2 ; 
00013   static int minlhs=1, minrhs=2, maxlhs=1, maxrhs=2;
00014   static char name[] = "disp" ;
00015 
00016   CheckRhs(minrhs,maxrhs) ;
00017   CheckLhs(minlhs,maxlhs) ;
00018 
00019   GetRhsVar(1, "d", &m1, &n1, &l1);
00020   GetRhsVar(2, "d", &m2, &n2, &l2);
00021 
00022   /* 
00023    *  To call a function it is required that its input arguments are
00024    *  stored in the last positions of the variables stack (it is the
00025    *  case here. NOTE that when 
00026    *  called, the function destroys its input variables and replaces them by 
00027    *  the output variables. 
00028    *  Here  function  takes  variables 1 and 2 as inputs and generates output
00029    *  variables at positions 1.
00030    *  ibegin must be the index of the first input variable of a_function
00031    */
00032   ibegin=1;
00033 
00034   /* execute the Scilab disp function */
00035   mlhs=1; mrhs=2; 
00036   SciString(&ibegin,name,&mlhs,&mrhs);
00037   /* check if an error has occured while running a_function */
00038   if (Err > 0 ) return 0;
00039 
00040   /*  Note that disp, as every function which has nothing to return,
00041    *  creates as output a variable with special type 0.
00042    */
00043 
00044   LhsVar(1) = 0; 
00045   return 0;
00046 }
00047 

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