intview.c

Go to the documentation of this file.
00001 #include "stack-c.h"
00002 
00003 
00004 /*--------------------------------------------------------
00005  * intview: interface for C displ function 
00006  *     should provide [X,Y,Z]=view(X,Y,Z)  at Scilab level 
00007  *
00008  *--------------------------------------------------------*/
00009 
00010 extern void displ __PARAMS((double *a, int ma, int na, int *b, int mb, int nb, char *c, int mc, int nc));
00011 
00012 int intview(fname) 
00013      char *fname;
00014 {
00015   static int l1, m1, n1, l2, m2, n2, m3, n3, l3;
00016   static int minlhs=1, maxlhs=3, minrhs=3, maxrhs=3;
00017 
00018   /* Check number of inputs (rhs=3) and outputs (lhs=3) */
00019   CheckRhs(minrhs,maxrhs) ;
00020   CheckLhs(minlhs,maxlhs) ;
00021 
00022   /* Get X (1 ,double), Y (2, int) and  C (3, string) */
00023   GetRhsVar(1, "d", &m1, &n1, &l1);
00024   GetRhsVar(2, "i", &m2, &n2, &l2);
00025   GetRhsVar(3, "c", &m3, &n3, &l3);
00026 
00027   /* Call display function
00028      stk(l1)->X (double), istk(l2)->Y (int), cstk(l3)->Z  (char)    */
00029   displ(stk(l1), m1, n1, istk(l2), m2, n2, cstk(l3), m3, n3);
00030 
00031   /*  Return variables  */
00032   LhsVar(1) = 1;
00033   LhsVar(2) = 2;
00034   LhsVar(3) = 3;
00035   return 0;
00036 }
00037 
00038 /*--------------------------------------------------------
00039  * C function displ 
00040  *--------------------------------------------------------*/
00041 
00042 void displ(a, ma, na, b, mb, nb, c, mc, nc)
00043      double *a; int *b; char *c;
00044      int ma, na, mb, nb, mc, nc;
00045 {
00046   sciprint("First parameter (matrix) is %i x %i:\r\n",ma,na);
00047   sciprint("its (1,1) entry is %e (double).\r\n", a[0]);
00048   sciprint("Second parameter (matrix) is %i x %i:\r\n",mb,nb);
00049   sciprint("its (1,1) entry is %i (int).\r\n", b[0]);
00050   sciprint("Third parameter (string) is %i character long: it is the string \"%s\"\r\n",mc*nc, c);
00051 }
00052 
00053 
00054 
00055 
00056 

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