1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2006-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- Non-regression test for bug 1957 -->
//
// <-- Bugzilla URL -->
// http://bugzilla.scilab.org/show_bug.cgi?id=1957
//
// <-- Short Description -->
// Non fonctionnement de intersci pour les variables optionnelles (au
// moins scalaires)
tab = ascii(9);
path = TMPDIR;
desc=['foo'+tab+'x'+tab+'y'+tab+'[ITMAX 2000]'+tab+'[eps 0.001]'
'x'+tab+'scalar'
'y'+tab+'scalar'
'ITMAX'+tab+'scalar'
'eps '+tab+'scalar'
'r'+tab+'vector 4'
''
'foo'+tab+'x'+tab+'y'+tab+' ITMAX'+tab+'eps'+tab+'r'
'x'+tab+'double'
'y'+tab+'double'
'ITMAX'+tab+'integer'
'eps'+tab+'double'
'r'+tab+'double'
''
'out sequence'+tab+'r'
'*******************'];
mputl(desc,path+'/intsfoo.desc')
foo_code=['#include ""stack-c.h""'
'void C2F(foo)(double *x,double *y,int *ITMAX,double *eps,double *r)'
' {'
' r[0]=*x; r[1]=*y; r[2]=*ITMAX; r[3]=*eps;'
' }'];
mputl(foo_code,path+'/foo.c')
intersci=getshortpathname(SCI+'/modules/intersci/bin/intersci-n')
intersci =
SCI/modules/intersci/bin/intersci-n
curpath=pwd();
chdir(path);
try
unix_s(intersci+' intsfoo')
ilib_build('buglib',['bug1957','intsfoo'],['foo.o','intsfoo.o'],[])
Generate a gateway file
Generate a loader file
Generate a Makefile: Makelib
Running the makefile
Compilation of foo
Compilation of intsfoo
Building shared library (be patient)
exec loader.sce
// ------------------------------------------------------
// generated by builder.sce: Please do not edit this file
// ------------------------------------------------------
buglib_path = get_file_path('loader.sce');
list_functions = [ 'bug1957';
];
addinter(buglib_path+'/buglib.dll','buglib',list_functions);
Shared archive loaded.
Link done.
// remove temp. variables on stack
clear buglib_path;
clear list_functions;
clear get_file_path;
// ------------------------------------------------------
catch
if %T then bugmes();quit;end
return
end
chdir(curpath);
res=bug1957(1.2,-2.3);
VAL = 2000;
if norm(res-[1.2,-2.3,VAL,0.001])-VAL >= 2d-1 then bugmes();quit;end
ITMAX=33;
res=bug1957(1.2,-2.3);
if norm(res-[1.2,-2.3,33,0.001])-ITMAX >= 2d-1 then bugmes();quit;end
eps=1d-7;
res=bug1957(1.2,-2.3);
VAL = 2000;
if norm(res-[1.2,-2.3,VAL,1d-7])-VAL >= 2d-1 then bugmes();quit;end
ITMAX=33;
res=bug1957(1.2,-2.3);
if norm(res-[1.2,-2.3,ITMAX,1d-7])-ITMAX >= 2d-1 then bugmes();quit;end
|