3
files=G_make(['externals.o'],'externals.dll');
6
routines=[pref(ones(1,14))+string(1:14)+suf(ones(1,14))];
11
for s=routines; link(files,s);end
15
//(very) simple example 1
16
a=[1,2,3];b=[4,5,6];n=3;
17
c=call('ext1f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
18
if norm(c-(a+b)) > %eps then pause,end
21
a=[1,2,3];b=[4,5,6];n=3;
22
c=call('ext2f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
23
if norm(c-(sin(a)+cos(b))) > %eps then pause,end
26
a=[1,2,3];b=[4,5,6];n=3;
27
c=call('ext3f','yes',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d');
28
if norm(c-(sin(a)+cos(b)))> %eps then pause,end
29
c=call('ext3f','no',1,'c',n,2,'i',a,3,'d',b,4,'d','out',[1,3],5,'d');
30
if norm(c-(a+b)) > %eps then pause,end
33
a=[1,2,3];b=[4,5,6];n=3;yes='yes';
34
c=call('ext4f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
35
if norm(c-(sin(a)+cos(b))) > %eps then pause,end
37
c=call('ext4f',n,1,'i',a,2,'d',b,3,'d','out',[1,3],4,'d');
38
if norm(c-(a+b)) > %eps then pause,end
39
//clear yes --> undefined variable : yes
42
// reading vector a in scilab internal stack
44
c=call('ext5f',b,1,'d','out',[1,3],2,'d');
45
if norm(c-(a+2*b)) > %eps then pause,end
48
//reading vector with name='a' in scilab internal stack
50
c=call('ext6f','a',1,'c',b,2,'d','out',[1,3],3,'d');
51
if norm(c-(a+2*b)) > %eps then pause,end
55
//creating vector c in scilab internal stack
58
//c does not exist (c made by ext7f)
59
c1=call('ext7f',a,1,'d',b,2,'d','out',2);
60
if norm(c1-b) > %eps then pause,end
62
if norm(c-(a+2*b)) > %eps then pause,end
64
if d<>"test" then pause,end
67
//param must be defined as a scilab variable
69
y=call('ext8f','out',size(param),1,'d');
70
if norm(y-param) > %eps then pause,end
73
//call ext9f argument function with dynamic link
74
yref=ode([1;0;0],0,[0.4,4],'ext9f');
77
//passing a parameter to ext10f routine by a list:
78
param=[0.04,10000,3d+7];
79
y=ode([1;0;0],0,[0.4,4],list('ext10f',param));
80
if norm(y-yref) > 10000*%eps then pause,end
83
//Passing a parameter to argument funtion of ode
84
param=[0.04,10000,3d+7];
85
y=ode([1;0;0],0,[0.4,4],'ext11f');
86
//param must be defined as a scilab variable upon calling ode
87
if norm(y-yref) > 10000*%eps then pause,end
90
//same example as # 10 with call to matptr
91
//param must be defined as a scilab variable
92
param=[0.04,10000,3d+7];
93
y=ode([1;0;0],0,[0.4,4],'ext12f');
94
if norm(y-yref) > 10000*%eps then pause,end
100
call('ext13f',n,1,'i',a,2,'r','out',2); //loads b with a
101
c=call('ext14f',n,1,'i','out',[1,10],2,'r'); //loads c with b
102
if norm(c-a) > %eps then pause,end