intex12c.c

Go to the documentation of this file.
00001 #include "stack-c.h"
00002 
00003 
00004 extern int C2F(dscal) __PARAMS((integer *n, double *da,double *dx,integer *incx));
00005 
00006 /**************************************************
00007  * Calling the scilab function "mypoly" inside the interface 
00008  * "mypoly" is defined in ex12c.sce
00009  **************************************************/
00010 
00011 int intex12c(fname) 
00012      char *fname;
00013 {
00014   int mlhs,mrhs,ibegin,un=1,mn2;
00015   static int l1, m1, n1, m2, n2, l2 ; 
00016   static int minlhs=1, minrhs=2, maxlhs=1, maxrhs=2;
00017   static char name[] = "mypoly" ;
00018 
00019   CheckRhs(minrhs,maxrhs) ;
00020   CheckLhs(minlhs,maxlhs) ;
00021 
00022   GetRhsVar(1, "d", &m1, &n1, &l1);
00023   GetRhsVar(2, "d", &m2, &n2, &l2);
00024 
00027   C2F(dscal)((mn2=m2*n2,&mn2),stk(l1),stk(l2),&un);
00028 
00029   /* call mypoly to create the polynomial from its roots 
00030    *
00031    *  To call a function it is required that its input arguments are
00032    *  stored in the last positions of the variables stack (it is the
00033    *  ase here. NOTE that when 
00034    *  called, the function destroys its input variables and replaces them by 
00035    *  the output variables. 
00036    *  Here  function  takes  variables 1 and 2 as inputs and generates output
00037    *  variables at positions 1.
00038    *  ibegin must be the index of the first input variable of a_function
00039    */
00040   ibegin=2;
00041 
00042   /* execute the function "mypoly" */
00043   mlhs=1; mrhs=1 ; 
00044   SciString(&ibegin,name,&mlhs,&mrhs);
00045   /* check if an error has occured while running mypoly */
00046   if (Err > 0 ) return 0;
00047 
00048   LhsVar(1) = 2; 
00049   return 0;
00050 }
00051 

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