diff options
author | Bernard HUGUENEY <bernard.hugueney@scilab.org> | 2010-05-19 11:47:47 +0200 |
---|---|---|
committer | Allan CORNET <allan.cornet@scilab.org> | 2010-05-20 08:09:31 +0200 |
commit | 7d93ad6a7cf9e91f6725155dac31c72b9887be72 (patch) | |
tree | 5c5865b24af70787ac733173d4d4ebeb315e7cb9 | |
parent | 14a92190dcba19d21a4c64e4095ce695556cf6cc (diff) | |
download | scilab-7d93ad6a7cf9e91f6725155dac31c72b9887be72.zip scilab-7d93ad6a7cf9e91f6725155dac31c72b9887be72.tar.gz |
Bug fix for #7138
Change-Id: Id26f7f23ff1f64418dad73f95dd797a9168f5d56
-rw-r--r-- | scilab/modules/core/src/cpp/search_functions.cpp | 34 | ||||
-rw-r--r-- | scilab/modules/core/tests/nonreg_tests/bug_7138.dia.ref | 16 | ||||
-rw-r--r-- | scilab/modules/core/tests/nonreg_tests/bug_7138.tst | 20 |
3 files changed, 60 insertions, 10 deletions
diff --git a/scilab/modules/core/src/cpp/search_functions.cpp b/scilab/modules/core/src/cpp/search_functions.cpp index d44ad8b..c49cee1 100644 --- a/scilab/modules/core/src/cpp/search_functions.cpp +++ b/scilab/modules/core/src/cpp/search_functions.cpp | |||
@@ -143,7 +143,22 @@ void C2F(siflibs)(int* id, int* k_ptr, int* istr, int* lbibn_ptr, int* nbibn_ptr | |||
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | 145 | ||
146 | /* search for an id in vars, also lifted from Fortran code in funs.f */ | 146 | /* search for an id in vars, also lifted from Fortran code in funs.f |
147 | 30 k=bot-1 | ||
148 | 31 k=k+1 | ||
149 | if(k.gt.isiz) goto 35 | ||
150 | if(.not.eqid(idstk(1,k),id)) goto 31 | ||
151 | il=iadr(lstk(k)) | ||
152 | c modif 1.3 SS | ||
153 | if(istk(il).ne.11.and.istk(il).ne.13) then | ||
154 | fin=0 | ||
155 | fun=0 | ||
156 | return | ||
157 | endif | ||
158 | fin=k | ||
159 | fun=-1 | ||
160 | return | ||
161 | */ | ||
147 | void C2F(sivars)(int* id, int* should_return) | 162 | void C2F(sivars)(int* id, int* should_return) |
148 | { | 163 | { |
149 | int* const lstk_ptr = (int*)C2F(vstk).lstk-1; | 164 | int* const lstk_ptr = (int*)C2F(vstk).lstk-1; |
@@ -159,19 +174,18 @@ void C2F(sivars)(int* id, int* should_return) | |||
159 | 174 | ||
160 | if (k <= C2F(vstk).isiz) | 175 | if (k <= C2F(vstk).isiz) |
161 | {/* eq_id */ | 176 | {/* eq_id */ |
162 | int il=lstk_ptr[k];/* iadr() */ | 177 | int il=lstk_ptr[k]; |
163 | il<<=1; | 178 | il=il+il-1;/* iadr() */ |
164 | ++il; | ||
165 | |||
166 | if ((*istk(il) != sci_u_function) && (*istk(il) != sci_c_function)) | 179 | if ((*istk(il) != sci_u_function) && (*istk(il) != sci_c_function)) |
167 | { | 180 | { |
168 | C2F(com).fun= Fin= 0; | 181 | C2F(com).fun= Fin= 0; |
169 | *should_return= f_true; | ||
170 | } | 182 | } |
171 | 183 | else | |
172 | C2F(com).fun= -1; | 184 | { |
173 | Fin= k; | 185 | C2F(com).fun= -1; |
186 | Fin= k; | ||
187 | } | ||
174 | *should_return= f_true; | 188 | *should_return= f_true; |
175 | } | 189 | } |
176 | return; /* *should_return= f_false; */ | 190 | return; |
177 | } | 191 | } |
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_7138.dia.ref b/scilab/modules/core/tests/nonreg_tests/bug_7138.dia.ref new file mode 100644 index 0000000..b1e6384 --- /dev/null +++ b/scilab/modules/core/tests/nonreg_tests/bug_7138.dia.ref | |||
@@ -0,0 +1,16 @@ | |||
1 | // ============================================================================= | ||
2 | // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab | ||
3 | // Copyright (C) 2010 - DIGITEO - Bernard HUGUENEY | ||
4 | // | ||
5 | // This file is distributed under the same license as the Scilab package. | ||
6 | // ============================================================================= | ||
7 | // <-- Non-regression test for bug 7138 --> | ||
8 | // | ||
9 | // <-- Bugzilla URL --> | ||
10 | // http://bugzilla.scilab.org/show_bug.cgi?id=7138 | ||
11 | // | ||
12 | // <-- Short Description --> | ||
13 | // could not assign a function to a var anymore | ||
14 | // <-- JVM NOT MANDATORY --> | ||
15 | a= rand; | ||
16 | r=a(1); | ||
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_7138.tst b/scilab/modules/core/tests/nonreg_tests/bug_7138.tst new file mode 100644 index 0000000..bee339a --- /dev/null +++ b/scilab/modules/core/tests/nonreg_tests/bug_7138.tst | |||
@@ -0,0 +1,20 @@ | |||
1 | // ============================================================================= | ||
2 | // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab | ||
3 | // Copyright (C) 2010 - DIGITEO - Bernard HUGUENEY | ||
4 | // | ||
5 | // This file is distributed under the same license as the Scilab package. | ||
6 | // ============================================================================= | ||
7 | |||
8 | // <-- Non-regression test for bug 7138 --> | ||
9 | // | ||
10 | // <-- Bugzilla URL --> | ||
11 | // http://bugzilla.scilab.org/show_bug.cgi?id=7138 | ||
12 | // | ||
13 | // <-- Short Description --> | ||
14 | // could not assign a function to a var anymore | ||
15 | |||
16 | // <-- JVM NOT MANDATORY --> | ||
17 | |||
18 | a= rand; | ||
19 | r=a(1); | ||
20 | |||