//Copyright INRIA //(very) simple example 1 files=G_make(['/tmp/ext1c.o'],'ext1c.dll'); link(files,'ext1c','C'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext1c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //Copyright INRIA //(very) simple example 1 files=G_make(['/tmp/ext1f.o'],'ext1f.dll'); link(files,'ext1f'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext1f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //Copyright INRIA //Simple example #2 files=G_make(['/tmp/ext2c.o'],'ext2c.dll'); link(files,'ext2c','C'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext2c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(sin(a)+cos(b))) > %eps then bugmes();quit;end //Copyright INRIA //Simple example #2 files=G_make(['/tmp/ext2f.o'],'ext2f.dll'); link(files,'ext2f'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext2f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(sin(a)+cos(b))) > %eps then bugmes();quit;end //Copyright INRIA //Example #3 files=G_make(['/tmp/ext3c.o'],'ext3c.dll'); link(files,'ext3c','C'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext3c','yes',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d'); if norm(c-(sin(a)+cos(b)))> %eps then bugmes();quit;end c=call('ext3c','no',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //Copyright INRIA //Example #3 files=G_make(['/tmp/ext3f.o'],'ext3f.dll'); link(files,'ext3f'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=call('ext3f','yes',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d'); if norm(c-(sin(a)+cos(b)))> %eps then bugmes();quit;end c=call('ext3f','no',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //Copyright INRIA files=G_make(['/tmp/ext4c.o'],'ext4c.dll'); link(files,'ext4c','C'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3;YesOrNo='yes'; c=call('ext4c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(sin(a)+cos(b))) > %eps then bugmes();quit;end YesOrNo='no'; c=call('ext4c',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //clear yes --> undefined variable : yes //Copyright INRIA files=G_make(['/tmp/ext4f.o'],'ext4f.dll'); link(files,'ext4f'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3;yes='yes'; c=call('ext4f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(sin(a)+cos(b))) > %eps then bugmes();quit;end yes='no'; c=call('ext4f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d'); if norm(c-(a+b)) > %eps then bugmes();quit;end //clear yes --> undefined variable : yes //Copyright INRIA files=G_make(['/tmp/ext5c.o'],'ext5c.dll'); link(files,'ext5c','C'); shared archive loaded Link done // reading vector a in scilab internal stack Amatrix=[1,2,3];b=[2,3,4]; c=call('ext5c',b,1,'d','out',[1,3],2,'d'); if norm(c-(Amatrix+2*b)) > %eps then bugmes();quit;end //Copyright INRIA files=G_make(['/tmp/ext5f.o'],'ext5f.dll'); link(files,'ext5f'); shared archive loaded Link done // reading vector a in scilab internal stack a=[1,2,3];b=[2,3,4]; c=call('ext5f',b,1,'d','out',[1,3],2,'d'); if norm(c-(a+2*b)) > %eps then bugmes();quit;end //Copyright INRIA //reading vector with name='a' in scilab internal stack files=G_make(['/tmp/ext6c.o'],'ext6c.dll'); link(files,'ext6c','C'); shared archive loaded Link done a=[1,2,3];b=[2,3,4]; c=call('ext6c','a',1,'c',b,2,'d','out',[1,3],3,'d'); if norm(c-(a+2*b)) > %eps then bugmes();quit;end //Copyright INRIA //reading vector with name='a' in scilab internal stack files=G_make(['/tmp/ext6f.o'],'ext6f.dll'); link(files,'ext6f'); shared archive loaded Link done a=[1,2,3];b=[2,3,4]; c=call('ext6f','a',1,'c',b,2,'d','out',[1,3],3,'d'); if norm(c-(a+2*b)) > %eps then bugmes();quit;end //Copyright INRIA //creating vector c in scilab internal stack files=G_make(['/tmp/ext7c.o'],'ext7c.dll'); link(files,'ext7c','C'); shared archive loaded Link done a=[1,2,3]; b=[2,3,4]; //c does not exist (c made by ext7c) c1=call('ext7c',a,1,'d',b,2,'d','out',2); if norm(c1-b) > %eps then bugmes();quit;end //c now exists if norm(c-(a+2*b)) > %eps then bugmes();quit;end //d exists if d<>"test" then bugmes();quit;end //Copyright INRIA //creating vector c in scilab internal stack files=G_make(['/tmp/ext7f.o'],'ext7f.dll'); link(files,'ext7f'); shared archive loaded Link done a=[1,2,3]; b=[2,3,4]; //c does not exist (c made by ext7f) c1=call('ext7f',a,1,'d',b,2,'d','out',2); if norm(c1-b) > %eps then bugmes();quit;end //c now exists if norm(c-(a+2*b)) > %eps then bugmes();quit;end //d exists if d<>"test" then bugmes();quit;end //Copyright INRIA //same example as # 10 with call to matptr //param must be defined as a scilab variable files=G_make(['/tmp/ext8c.o'],'ext8c.dll'); link(files,'ext8c','C'); shared archive loaded Link done param=[1,2,3] param = 1. 2. 3. y=call('ext8c','out',size(param),1,'d'); if norm(y-param) > %eps then bugmes();quit;end if norm(param(1)-18.0) > %eps then bugmes();quit;end //Copyright INRIA //same example as # 10 with call to matptr //param must be defined as a scilab variable files=G_make(['/tmp/ext8f.o'],'ext8f.dll'); link(files,'ext8f'); shared archive loaded Link done param=[1,2,3]; y=call('ext8f','out',size(param),1,'d'); if norm(y-param) > %eps then bugmes();quit;end if norm(param(1)-18.0) > %eps then bugmes();quit;end //Copyright INRIA //argument function for ode //call ext9c argument function with dynamic link files=G_make(['/tmp/ext9c.o'],'ext9c.dll'); link(files,'ext9c','C'); shared archive loaded Link done ode([1;0;0],0,[0.4,4],'ext9c') ans = 0.9851721 0.9055187 0.0000339 0.0000224 0.0147940 0.0944589 //Copyright INRIA //argument function for ode //call ext9f argument function with dynamic link files=G_make(['/tmp/ext9f.o'],'ext9f.dll'); link(files,'ext9f'); shared archive loaded Link done ode([1;0;0],0,[0.4,4],'ext9f') ans = 0.9851721 0.9055187 0.0000339 0.0000224 0.0147940 0.0944589 //Copyright INRIA files=G_make(['/tmp/ext10c.o'],'ext10c.dll'); link(files,'ext10c','C'); shared archive loaded Link done //passing a parameter to ext10c routine by a list: param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],list('ext10c',param)) y = 0.9851721 0.9055187 0.0000339 0.0000224 0.0147940 0.0944589 //Copyright INRIA files=G_make(['/tmp/ext10f.o'],'ext10f.dll'); link(files,'ext10f'); shared archive loaded Link done //passing a parameter to ext10f routine by a list: param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],list('ext10f',param)) y = 0.9851721 0.9055187 0.0000339 0.0000224 0.0147940 0.0944589 //Copyright INRIA //Passing a parameter to argument funtion of ode files=G_make(['/tmp/ext11c.o'],'ext11c.dll'); link(files,'ext11c','C'); shared archive loaded Link done param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],'ext11c') y = 0.9851721 0.9055187 0.0000339 0.0000224 0.0147940 0.0944589 //param must be defined as a scilab variable upon calling ode //Copyright INRIA //Passing a parameter to argument funtion of ode files=G_make(['/tmp/ext11f.o'],'ext11f.dll'); link(files,'ext11f'); shared archive loaded Link done param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],'ext11f'); //param must be defined as a scilab variable upon calling ode //Copyright INRIA //same example as # 10 with call to matptr //param must be defined as a scilab variable files=G_make(['/tmp/ext12c.o'],'ext12c.dll'); link(files,'ext12c','C'); shared archive loaded Link done param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],'ext12c'); //Copyright INRIA //same example as # 10 with call to matptr //param must be defined as a scilab variable files=G_make(['/tmp/ext12f.o'],'ext12f.dll'); link(files,'ext12f'); shared archive loaded Link done param=[0.04,10000,3d+7]; y=ode([1;0;0],0,[0.4,4],'ext12f'); //Copyright INRIA //sharing common data files=G_make(['/tmp/ext13c.o'],'ext13c.dll'); link(files,['ext13ic','ext13oc'],'C'); //Must be linked together shared archive loaded Link done a=1:10; n=10;a=1:10; call('ext13ic',n,1,'i',a,2,'r','out',2); //loads b with a c=call('ext13oc',n,1,'i','out',[1,10],2,'r'); //loads c with b if norm(c-a) > %eps then bugmes();quit;end //Copyright INRIA //sharing common data files=G_make(['/tmp/ext13f.o'],'ext13f.dll'); link(files,['ext13if','ext13of']); //Must be linked together shared archive loaded Link done a=1:10; n=10;a=1:10; call('ext13if',n,1,'i',a,2,'r','out',2); //loads b with a c=call('ext13of',n,1,'i','out',[1,10],2,'r'); //loads c with b if norm(c-a) > %eps then bugmes();quit;end //Copyright INRIA //(very) simple example 1 files=G_make(['/tmp/ext14c.o'],'ext14c.dll'); link(files,'ext14cI','C'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=fort('ext14cI',a,b); if norm(c-(a+b)) > %eps then bugmes();quit;end //Copyright INRIA //(very) simple example 1 files=G_make(['/tmp/ext14f.o'],'ext14f.dll'); link(files,'ext14fi'); shared archive loaded Link done a=[1,2,3];b=[4,5,6];n=3; c=fort('ext14fi',a,b); if norm(c-(a+b)) > %eps then bugmes();quit;end