intex3c.c

Go to the documentation of this file.
00001 #include <string.h> 
00002 #include <stdio.h>
00003 #include "stack-c.h"
00004 
00005 /**************************************************
00006  * examples of an hand written interface 
00007  * Shows how to pass 
00008  *       - Scilab boolean matrices as arguments 
00009  *       how to create and return new boolean matrices
00010  **************************************************/
00011 
00012 /*-------------------------------------------------
00013  * GetRhsVar(..,'b',...) and CreateVar(..,'b',...
00014  *-------------------------------------------------*/
00015 
00016 static void not __PARAMS((int * iv1,int *iv2,int  size));
00017 
00018 int intex3c(char *fname) 
00019 {
00020   static int l1,m1, n1,l2;
00021   static int minlhs=1, minrhs=1, maxlhs=1, maxrhs=1;
00022 
00023   CheckRhs(minrhs,maxrhs) ;
00024   CheckLhs(minlhs,maxlhs) ;
00025 
00026   /* a boolean matrix argument */ 
00027   
00028   GetRhsVar(1, "b", &m1, &n1, &l1);
00029 
00030   /* create a new boolean matrix same size as first argument 
00031    *
00032    * note that this is only for illustration since we could directly work 
00033    * with istk(l1) which can be modified and returned. 
00034    */
00035 
00036   CreateVar(2, "b",&m1,&n1,&l2);
00037 
00038   /* fills new matrix  */
00039   
00040   not(istk(l2),istk(l1),m1*n1);
00041 
00042   LhsVar(1) = 2; /* returns new matrix */
00043   return 0;
00044 }
00045 
00046 
00047 static void not( iv1,iv2, size)
00048      int *iv1,*iv2;
00049      int size;
00050 {
00051   int i;
00052   for ( i=0 ; i < size ; i++) iv1[i] = ! iv2[i];
00053 }

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