summaryrefslogtreecommitdiffstats
path: root/scilab/modules/intersci
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-08-25 12:07:03 +0200
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-08-27 09:49:30 +0200
commit472e1c8332b673b5e336dbfc295fddc8c3fc3b43 (patch)
tree74c7875797cfcd65e7c481dbef3e5822c01d7e8b /scilab/modules/intersci
parent2a1b0756d76dbc6358aba91bca9a2cc546089402 (diff)
downloadscilab-472e1c8332b673b5e336dbfc295fddc8c3fc3b43.zip
scilab-472e1c8332b673b5e336dbfc295fddc8c3fc3b43.tar.gz
bug 7603: intersci and f2c
Change-Id: Ic1303e9a21457f19ad399a3075e98422fe0604a6
Diffstat (limited to 'scilab/modules/intersci')
-rw-r--r--scilab/modules/intersci/src/exe/intersci.c14
-rw-r--r--scilab/modules/intersci/tests/nonreg_tests/bug7603.desc13
-rw-r--r--scilab/modules/intersci/tests/nonreg_tests/bug7603function.c23
-rw-r--r--scilab/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref32
-rw-r--r--scilab/modules/intersci/tests/nonreg_tests/bug_7603.tst39
5 files changed, 112 insertions, 9 deletions
diff --git a/scilab/modules/intersci/src/exe/intersci.c b/scilab/modules/intersci/src/exe/intersci.c
index 5aa1c5b..944c9d5 100644
--- a/scilab/modules/intersci/src/exe/intersci.c
+++ b/scilab/modules/intersci/src/exe/intersci.c
@@ -1,6 +1,7 @@
1/* 1/*
2* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3* Copyright (C) ????-2008 - INRIA 3* Copyright (C) ????-2008 - INRIA
4* Copyright (C) 2010 - DIGITEO - Allan CORNET
4* 5*
5* This file must be used under the terms of the CeCILL. 6* This file must be used under the terms of the CeCILL.
6* This source file is licensed as described in the file COPYING, which 7* This source file is licensed as described in the file COPYING, which
@@ -1213,21 +1214,16 @@ char *SGetForType(int type)
1213Code generation 1214Code generation
1214***************************************************************/ 1215***************************************************************/
1215 1216
1216
1217void WriteMainHeader(FILE *f,char *fname) 1217void WriteMainHeader(FILE *f,char *fname)
1218{ 1218{
1219 char *scidir;
1220 Fprintf(f,indent,"subroutine %s\n",fname); 1219 Fprintf(f,indent,"subroutine %s\n",fname);
1221 scidir = getenv("SCI"); 1220 /* path of stack.h must be defined in FFLAGS */
1222 if ( scidir != NULL) 1221 /* same behaviour that others definitions of this include see line 1232 */
1223 Fprintf(f,indent,"include '%s/modules/core/includes/stack.h'\n",scidir); 1222 Fprintf(f,indent,"include 'stack.h'\n");
1224 else
1225 Fprintf(f,indent,"include 'SCIDIR/modules/core/includes/stack.h'\n");
1226 Fprintf(f,indent,"rhs = max(0,rhs)\n"); 1223 Fprintf(f,indent,"rhs = max(0,rhs)\n");
1227 FCprintf(f,"c\n"); 1224 FCprintf(f,"c\n");
1228} 1225}
1229 1226
1230
1231void WriteHeader(FILE *f,char *fname0,char *fname) 1227void WriteHeader(FILE *f,char *fname0,char *fname)
1232{ 1228{
1233 Fprintf(f,indent,"subroutine %s%s(fname)\n",fname0,fname); 1229 Fprintf(f,indent,"subroutine %s%s(fname)\n",fname0,fname);
@@ -1235,7 +1231,7 @@ void WriteHeader(FILE *f,char *fname0,char *fname)
1235 Fprintf(f,indent,"character*(*) fname\n"); 1231 Fprintf(f,indent,"character*(*) fname\n");
1236 Fprintf(f,indent,"include 'stack.h'\n"); 1232 Fprintf(f,indent,"include 'stack.h'\n");
1237 FCprintf(f,"c\n"); 1233 FCprintf(f,"c\n");
1238 Fprintf(f,indent,"int iadr, sadr\n"); 1234 Fprintf(f,indent,"integer iadr, sadr\n");
1239 WriteDeclaration(f); 1235 WriteDeclaration(f);
1240 Fprintf(f,indent,"iadr(l)=l+l-1\n"); 1236 Fprintf(f,indent,"iadr(l)=l+l-1\n");
1241 Fprintf(f,indent,"sadr(l)=(l/2)+1\n"); 1237 Fprintf(f,indent,"sadr(l)=(l/2)+1\n");
diff --git a/scilab/modules/intersci/tests/nonreg_tests/bug7603.desc b/scilab/modules/intersci/tests/nonreg_tests/bug7603.desc
new file mode 100644
index 0000000..5768a55
--- /dev/null
+++ b/scilab/modules/intersci/tests/nonreg_tests/bug7603.desc
@@ -0,0 +1,13 @@
1ext1c a b
2a vector m
3b vector m
4c vector m
5
6ext1c m a b c
7m integer
8a double
9b double
10c double
11
12out sequence c
13***********************
diff --git a/scilab/modules/intersci/tests/nonreg_tests/bug7603function.c b/scilab/modules/intersci/tests/nonreg_tests/bug7603function.c
new file mode 100644
index 0000000..c0a25f7
--- /dev/null
+++ b/scilab/modules/intersci/tests/nonreg_tests/bug7603function.c
@@ -0,0 +1,23 @@
1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2010 - DIGITEO - Allan CORNET
4 *
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10 *
11 */
12
13
14#include "machine.h"
15
16int F2C(ext1c)(int *n, double *a, double *b, double *c)
17{
18 int k = 0;
19 for (k = 0; k < *n; ++k)
20 c[k] = a[k] + b[k];
21 return(0);
22}
23
diff --git a/scilab/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref b/scilab/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref
new file mode 100644
index 0000000..2a05f17
--- /dev/null
+++ b/scilab/modules/intersci/tests/nonreg_tests/bug_7603.dia.ref
@@ -0,0 +1,32 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- Non-regression test for bug 7603 -->
8//
9// <-- Bugzilla URL -->
10// http://bugzilla.scilab.org/show_bug.cgi?id=7603
11//
12// <-- Short Description -->
13// Fortran code generated by intersci did not build with a fortran or F2C compiler on Windows.
14//
15if getos() == 'Windows' then
16 copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603.desc", TMPDIR+"/bug7603.desc");
17 copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603function.c", TMPDIR+"/bug7603function.c");
18 cd(TMPDIR);
19 // check intersci generation
20 s1 = dos(SCI + '/modules/intersci/bin/intersci.exe bug7603');
21 if s1 <> %t then bugmes();quit;end
22 // check f2c conversion works
23 s2 = dos(SCI + "/bin/f2c.exe -I" + SCI + "/modules/core/includes " + "bug7603.f");
24 if s2 <> %t then bugmes();quit;end
25 if isfile("bug7603.c") then
26 mdelete("bug7603.c");
27 end
28 // check build
29 ilib_verbose(0);
30 ierr = execstr("ilib_build(""gw_bug7603"", [""bug7603"", ""bug7603_""], [""bug7603.f"", ""bug7603function.c""], []);", "errcatch");
31 if ierr <> 0 then bugmes();quit;end
32end
diff --git a/scilab/modules/intersci/tests/nonreg_tests/bug_7603.tst b/scilab/modules/intersci/tests/nonreg_tests/bug_7603.tst
new file mode 100644
index 0000000..009e223
--- /dev/null
+++ b/scilab/modules/intersci/tests/nonreg_tests/bug_7603.tst
@@ -0,0 +1,39 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- Non-regression test for bug 7603 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=7603
12//
13// <-- Short Description -->
14// Fortran code generated by intersci did not build with a fortran or F2C compiler on Windows.
15//
16
17if getos() == 'Windows' then
18
19 copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603.desc", TMPDIR+"/bug7603.desc");
20 copyfile(SCI+"/modules/intersci/tests/nonreg_tests/bug7603function.c", TMPDIR+"/bug7603function.c");
21 cd(TMPDIR);
22
23 // check intersci generation
24 s1 = dos(SCI + '/modules/intersci/bin/intersci.exe bug7603');
25 if s1 <> %t then pause, end
26
27 // check f2c conversion works
28 s2 = dos(SCI + "/bin/f2c.exe -I" + SCI + "/modules/core/includes " + "bug7603.f");
29 if s2 <> %t then pause, end
30 if isfile("bug7603.c") then
31 mdelete("bug7603.c");
32 end
33
34 // check build
35 ilib_verbose(0);
36 ierr = execstr("ilib_build(""gw_bug7603"", [""bug7603"", ""bug7603_""], [""bug7603.f"", ""bug7603function.c""], []);", "errcatch");
37 if ierr <> 0 then pause,end
38
39end