summaryrefslogtreecommitdiffstats
path: root/scilab/modules/core
diff options
context:
space:
mode:
authorPierre MARECHAL <pierre.marechal@scilab.org>2010-03-18 13:20:55 +0100
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-03-18 13:20:55 +0100
commit345d3322fde02e10ff2f7b06052e3b1b4749872d (patch)
tree946dd66c00331daa0a191a00730309be40d1899b /scilab/modules/core
parent764338cb571f74220ac229030cb45a702342975f (diff)
parentda094051acfde899e1dd2add9e479c95ce966477 (diff)
downloadscilab-345d3322fde02e10ff2f7b06052e3b1b4749872d.zip
scilab-345d3322fde02e10ff2f7b06052e3b1b4749872d.tar.gz
Merge commit 'origin/5.2'
Diffstat (limited to 'scilab/modules/core')
-rw-r--r--scilab/modules/core/src/c/expr.c8
-rw-r--r--scilab/modules/core/src/c/terme.c8
-rw-r--r--scilab/modules/core/src/fortran/fact.f47
-rw-r--r--scilab/modules/core/tests/nonreg_tests/bug_6730.dia.ref62
-rw-r--r--scilab/modules/core/tests/nonreg_tests/bug_6730.tst48
5 files changed, 162 insertions, 11 deletions
diff --git a/scilab/modules/core/src/c/expr.c b/scilab/modules/core/src/c/expr.c
index e0b333d..c609c05 100644
--- a/scilab/modules/core/src/c/expr.c
+++ b/scilab/modules/core/src/c/expr.c
@@ -37,6 +37,7 @@ extern int C2F(eptover)(int *, int *);
37#define plus 45 37#define plus 45
38#define minus 46 38#define minus 46
39#define ou 57 /* @TODO does 'ou' is 'or' in english ? */ 39#define ou 57 /* @TODO does 'ou' is 'or' in english ? */
40
40/*--------------------------------------------------------------------------*/ 41/*--------------------------------------------------------------------------*/
41int C2F(expr)(void) 42int C2F(expr)(void)
42{ 43{
@@ -46,7 +47,12 @@ int C2F(expr)(void)
46 int temp = 0; 47 int temp = 0;
47 int kount = 0; 48 int kount = 0;
48 49
49 if (C2F(iop).ddt == 4) { } 50 if (C2F(iop).ddt == 4) {
51 static char tmp[100];
52 static int io;
53 sprintf(tmp," expr pt:%d rstk(pt):%d sym:%d",C2F(recu).pt,C2F(recu).rstk[C2F(recu).pt - 1], C2F(com).sym);
54 C2F(basout)(&io, &C2F(iop).wte,tmp, (long)strlen(tmp));
55 }
50 56
51 r = C2F(recu).rstk[C2F(recu).pt - 1]; 57 r = C2F(recu).rstk[C2F(recu).pt - 1];
52 if (r == 204) goto L85; 58 if (r == 204) goto L85;
diff --git a/scilab/modules/core/src/c/terme.c b/scilab/modules/core/src/c/terme.c
index b028a42..a56080a 100644
--- a/scilab/modules/core/src/c/terme.c
+++ b/scilab/modules/core/src/c/terme.c
@@ -36,7 +36,13 @@ int C2F(terme)(void)
36 /* int equal,less,great,char_not */ 36 /* int equal,less,great,char_not */
37 r = C2F(recu).rstk[(constnumber + (0 + ( (C2F(recu).pt - 1) << 2)) - constnumber) / 4]; 37 r = C2F(recu).rstk[(constnumber + (0 + ( (C2F(recu).pt - 1) << 2)) - constnumber) / 4];
38 38
39 if (C2F(iop).ddt == 4) { } 39 if (C2F(iop).ddt == 4) {
40 static char tmp[100];
41 static int io;
42 sprintf(tmp," terme pt:%d rstk(pt):%d sym:%d",C2F(recu).pt, C2F(recu).rstk[C2F(recu).pt - 1], C2F(com).sym);
43 C2F(basout)(&io, &C2F(iop).wte,tmp, (long)strlen(tmp));
44
45 }
40 46
41 if ( (r / 100) != 2) 47 if ( (r / 100) != 2)
42 { /* first factor */ 48 { /* first factor */
diff --git a/scilab/modules/core/src/fortran/fact.f b/scilab/modules/core/src/fortran/fact.f
index 2de426a..cc22f01 100644
--- a/scilab/modules/core/src/fortran/fact.f
+++ b/scilab/modules/core/src/fortran/fact.f
@@ -16,7 +16,7 @@ c
16c 16c
17 parameter (nz1=nsiz-1,nz2=nsiz-2) 17 parameter (nz1=nsiz-1,nz2=nsiz-2)
18 logical eptover 18 logical eptover
19 integer r,excnt,psym,p,count 19 integer r,excnt,psym,p,count,v
20 integer id(nsiz),op,fun1 20 integer id(nsiz),op,fun1
21 integer star,dstar,semi,eol,blank,percen 21 integer star,dstar,semi,eol,blank,percen
22 integer comma,lparen,rparen,hat,dot,equal 22 integer comma,lparen,rparen,hat,dot,equal
@@ -52,7 +52,7 @@ c
52 dotsep=.false. 52 dotsep=.false.
53 ir=r/100 53 ir=r/100
54 if(ir.ne.3) goto 01 54 if(ir.ne.3) goto 01
55 goto(25,26,91,29,99,51,43,48,55,62,65,66,41),r-300 55 goto(25,26,91,29,99,52,43,48,55,62,65,66,41),r-300
56 goto 99 56 goto 99
57c 57c
58 01 continue 58 01 continue
@@ -118,7 +118,7 @@ c . errcatch mode off, really send an error
118 r=rstk(p) 118 r=rstk(p)
119 if(int(r/100).ne.3) goto 03 119 if(int(r/100).ne.3) goto 03
120 pt=p 120 pt=p
121 goto(25,26,99,29,99,51,43,48,55,62,65,66),r-300 121 goto(25,26,99,29,99,52,43,48,55,62,65,66),r-300
122 endif 122 endif
123 04 continue 123 04 continue
124 call error(2) 124 call error(2)
@@ -551,15 +551,14 @@ c skip empty argument list portion
551c empty argument list a(...)() 551c empty argument list a(...)()
552 461 excnt=excnt+1 552 461 excnt=excnt+1
553 call getsym 553 call getsym
554 lhs=pstk(pt) 554c lhs=pstk(pt)
555 call putid(id,ids(1,pt)) 555 call putid(id,ids(1,pt))
556 if ( eptover(1,psiz-1)) return 556 if ( eptover(1,psiz-1)) return
557 rstk(pt)=314 557 rstk(pt)=314
558 pstk(pt)=lhs 558c pstk(pt)=lhs
559 559 pstk(pt)=pstk(pt-1)
560 560
561 463 rhs = excnt 561 463 rhs = excnt
562
563c get function or variable to be evaluated for computed arguments 562c get function or variable to be evaluated for computed arguments
564 fin=0 563 fin=0
565 fin=-2 564 fin=-2
@@ -631,19 +630,49 @@ c . a(...) is a reference to a macro
631 top=top-1 630 top=top-1
632 goto 50 631 goto 50
633 endif 632 endif
633c next if for bug 6730 fix
634 if (istk(il).eq.13.or.istk(il).eq.11) then
635c . a(...) is a macro
636c . use negative value to indicate that this variable must be
637c . removed after the function has been evaluated
638 fin=-top
639 goto 50
640 endif
641
634 endif 642 endif
635 goto 60 643 goto 60
636c 644c
637c --- variable is macro : execution 645c --- variable is macro : execution
638c 646c
639 50 if ( eptover(1,psiz-1)) return 647 50 if ( eptover(1,psiz-1)) return
640 call putid(id,ids(1,pt)) 648c next if for bug 6730 fix
649c call putid(id,ids(1,pt))
650 if(fin.lt.0) then
651 ids(1,pt)=top
652 fin=lstk(top)
653 else
654 ids(1,pt)=0
655 endif
641 rstk(pt)=306 656 rstk(pt)=306
642 pstk(pt)=wmac 657 pstk(pt)=wmac
643 icall=5 658 icall=5
644c *call* macro 659c *call* macro
645 return 660 return
646 51 wmac=pstk(pt) 661 52 wmac=pstk(pt)
662c next if for bug 6730 fix
663 if(ids(1,pt).ne.0) then
664c . shift storage up to remove the macro
665 mtop=ids(1,pt)
666 v=lstk(mtop+1)-lstk(mtop)
667 call dcopy(lstk(top+1)-lstk(mtop+1),stk(lstk(mtop+1)),1
668 $ ,stk(lstk(mtop)),1)
669 do ib = mtop,top-1
670 call putid(idstk(1,ib),idstk(1,ib+1))
671 infstk(ib)=infstk(ib+1)
672 lstk(ib+1) = lstk(ib+2)-v
673 enddo
674 top=top-1
675 endif
647 pt=pt-1 676 pt=pt-1
648 go to 60 677 go to 60
649c 678c
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_6730.dia.ref b/scilab/modules/core/tests/nonreg_tests/bug_6730.dia.ref
new file mode 100644
index 0000000..1356d01
--- /dev/null
+++ b/scilab/modules/core/tests/nonreg_tests/bug_6730.dia.ref
@@ -0,0 +1,62 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2005-2010 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- Non-regression test for bug6730 -->
8//
9// <-- Bugzilla URL -->
10// http://bugzilla.scilab.org/show_bug.cgi?id=6730
11//
12// <-- Short Description -->
13//problem with function calls when seen has member of an mlist
14function [x,y,z]=myfun(varargin), x=varargin,y=2;z=3;,endfunction
15function fun=%foo_e(name,M); fun=myfun;endfunction
16a=mlist('foo');
17b=mlist(['foo','hello'],myfun);
18c=mlist(['foo','hello'],list('xxxx','yyyyy','zzzzz'));
19[x,y,z]=b.hello()
20 z =
21
22 3.
23 y =
24
25 2.
26 x =
27
28 ()
29if x<>list()|y<>2|z<>3 then bugmes();quit;end
30[x,y,z]=a.hello()
31 z =
32
33 3.
34 y =
35
36 2.
37 x =
38
39 ()
40if x<>list()|y<>2|z<>3 then bugmes();quit;end
41[x,y,z]=c.hello(1:3)
42 z =
43
44 zzzzz
45 y =
46
47 yyyyy
48 x =
49
50 xxxx
51if x<>'xxxx'|y<>'yyyyy'|z<>'zzzzz' then bugmes();quit;end
52function [x,y,z]=myfun(varargin), x=varargin,y=2;z=3;,endfunction
53function fun=%foo_e(name,M); fun=myfun;endfunction
54a=mlist('foo');
55b=mlist(['foo','hello'],myfun);
56c=mlist(['foo','hello'],list('xxxx','yyyyy','zzzzz'));
57if b.hello()<>list() then bugmes();quit;end
58if a.hello()<>list() then bugmes();quit;end
59if or(c.hello()<>list('xxxx','yyyyy','zzzzz')) then bugmes();quit;end
60if or(b.hello(1:2)<>list(1:2)) then bugmes();quit;end
61if or(a.hello(1:2)<>list(1:2)) then bugmes();quit;end
62if c.hello(2)<>'yyyyy' then bugmes();quit;end
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_6730.tst b/scilab/modules/core/tests/nonreg_tests/bug_6730.tst
new file mode 100644
index 0000000..cb768d3
--- /dev/null
+++ b/scilab/modules/core/tests/nonreg_tests/bug_6730.tst
@@ -0,0 +1,48 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2005-2010 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- Non-regression test for bug6730 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6730
12//
13// <-- Short Description -->
14//problem with function calls when seen has member of an mlist
15
16function [x,y,z]=myfun(varargin), x=varargin,y=2;z=3;,endfunction
17function fun=%foo_e(name,M); fun=myfun;endfunction
18a=mlist('foo');
19b=mlist(['foo','hello'],myfun);
20c=mlist(['foo','hello'],list('xxxx','yyyyy','zzzzz'));
21
22
23
24[x,y,z]=b.hello()
25if x<>list()|y<>2|z<>3 then pause,end
26
27[x,y,z]=a.hello()
28if x<>list()|y<>2|z<>3 then pause,end
29
30[x,y,z]=c.hello(1:3)
31if x<>'xxxx'|y<>'yyyyy'|z<>'zzzzz' then pause,end
32
33function [x,y,z]=myfun(varargin), x=varargin,y=2;z=3;,endfunction
34function fun=%foo_e(name,M); fun=myfun;endfunction
35
36
37a=mlist('foo');
38b=mlist(['foo','hello'],myfun);
39c=mlist(['foo','hello'],list('xxxx','yyyyy','zzzzz'));
40
41
42if b.hello()<>list() then pause,end
43if a.hello()<>list() then pause,end
44if or(c.hello()<>list('xxxx','yyyyy','zzzzz')) then pause,end
45
46if or(b.hello(1:2)<>list(1:2)) then pause,end
47if or(a.hello(1:2)<>list(1:2)) then pause,end
48if c.hello(2)<>'yyyyy' then pause,end