00001 /* Copyright Inria/Enpc */ 00002 #include "stack-c.h" 00003 00004 /****************************************** 00005 * example 7 00006 * creating vector c in scilab internal stack 00007 * -->link('ext7c.o','ext7c','C') 00008 * -->a=[1,2,3]; b=[2,3,4]; 00009 * c does not exist (c made by the call to matz) 00010 * -->call('ext7c',a,1,'d',b,2,'d','out',1); 00011 * c now exists 00012 * -->c=a+2*b 00013 ******************************************/ 00014 00015 00016 int ext7c(double *a, double *b) 00017 { 00018 static int c1 = 1; 00019 static int c3 = 3; 00020 static char str[] ="test"; 00021 int strl; 00022 00023 double c[3]; 00024 int k=0; 00025 for (k = 0; k < 3; k++) c[k] = a[k] + b[k] * 2.; 00027 WriteMatrix("c",&c1,&c3,c); 00029 strl=strlen(str); 00030 /* Creating the Scilab variable d from str */ 00031 WriteString("d", &strl, str); 00032 return(0); 00033 } 00034
1.5.1