diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/m2sci/macros/percent | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/m2sci/macros/percent')
67 files changed, 2495 insertions, 0 deletions
diff --git a/modules/m2sci/macros/percent/%02sci.bin b/modules/m2sci/macros/percent/%02sci.bin Binary files differnew file mode 100755 index 000000000..f6c128221 --- /dev/null +++ b/modules/m2sci/macros/percent/%02sci.bin diff --git a/modules/m2sci/macros/percent/%02sci.sci b/modules/m2sci/macros/percent/%02sci.sci new file mode 100755 index 000000000..40987f72b --- /dev/null +++ b/modules/m2sci/macros/percent/%02sci.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%02sci(tree) + // M2SCI function + // Conversion function for Matlab dot transpose + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_0() + + A = getoperands(tree) + + // Scilab and Matlab transposition do not work in the same way for strings + if or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_0",1,Rhs_tlist(A),tree.out) + tree.lhs(1).dims=list(A.dims(2),A.dims(1)) + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.operands=list(Funcall("bool2s",1,list(A),list())) + end + tree.out(1).dims=list(A.dims(2),A.dims(1)) + tree.out(1).type=A.type + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%52sci.bin b/modules/m2sci/macros/percent/%52sci.bin Binary files differnew file mode 100755 index 000000000..970038cee --- /dev/null +++ b/modules/m2sci/macros/percent/%52sci.bin diff --git a/modules/m2sci/macros/percent/%52sci.sci b/modules/m2sci/macros/percent/%52sci.sci new file mode 100755 index 000000000..a61d766d0 --- /dev/null +++ b/modules/m2sci/macros/percent/%52sci.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%52sci(tree) + // M2SCI function + // Conversion function for Matlab negation + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + A = getoperands(tree) + if and(A.vtype<>[Double,Boolean]) then + A = convert2double(A) + tree.operands=list(A) + end + + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/percent/%a2sci.bin b/modules/m2sci/macros/percent/%a2sci.bin Binary files differnew file mode 100755 index 000000000..fa8ced46c --- /dev/null +++ b/modules/m2sci/macros/percent/%a2sci.bin diff --git a/modules/m2sci/macros/percent/%a2sci.sci b/modules/m2sci/macros/percent/%a2sci.sci new file mode 100755 index 000000000..8c503ddd0 --- /dev/null +++ b/modules/m2sci/macros/percent/%a2sci.sci @@ -0,0 +1,79 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%a2sci(tree) + // M2SCI function + // Conversion function for Matlab addition + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_a() + + // In Matlab only two matrices with the same size can be added unless one is a scalar + // So empty matrix can only be added to a scalar or an onther empty matrix + // For example : [1,2,3]+[] is not possible + // An other important difference with Scilab is that : + // - Matlab gives : [1]+[]=[] + // - Scilab gives : [1]+[]=[1] + + // WARNING : translation does not work for codes like var=+'a' + // In this case, user have to modify M-file and replace +'a' by 0+'a' for example + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_a_s.sci + // - %s_a_b.sci + + // Binary operator: A+B + if size(tree.operands)==2 then + [A,B]=getoperands(tree) + + // Matlab and Scilab addition do not match for Strings + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_a_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean + A=convert2double(A) + end + + tree.operands=list(A,B) + + // Type inference + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + tree.out(1).type=Type(Double,Unknown) + end + + // When both operands are not [] Scilab and Matlab give the same results + if not_empty(A) & not_empty(B) then + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + // If at least one operand is [] then Matlab result is [] but not Scilab one + elseif is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("At least one operand of %s is an empty matrix, Scilab equivalent is []."),expression2code(tree)),0) + tree=Cste([]) + else + tree.out(1).dims=allunknown(A.dims) + tree=Funcall("mtlb_a",1,list(A,B),tree.out) + end + else + // This case can not exist because Scilab interpreter ignores unary + + A=getoperands(tree) + //A=convert2double(A) + tree.operands=list(A) + tree.out(1).infer=A.infer + end +endfunction diff --git a/modules/m2sci/macros/percent/%cc2sci.bin b/modules/m2sci/macros/percent/%cc2sci.bin Binary files differnew file mode 100755 index 000000000..70c10ed30 --- /dev/null +++ b/modules/m2sci/macros/percent/%cc2sci.bin diff --git a/modules/m2sci/macros/percent/%cc2sci.sci b/modules/m2sci/macros/percent/%cc2sci.sci new file mode 100755 index 000000000..9260b3ccf --- /dev/null +++ b/modules/m2sci/macros/percent/%cc2sci.sci @@ -0,0 +1,77 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%cc2sci(tree) + + // Make a 'column' with many rows + if tree.operands(1).vtype==Cell then + tree=%cc_cell2sci(tree) + return + end + + rownb=size(tree.operands) + col=list() + rowsize=[] + colsize=[] + + realrows=0 + complexrows=0 + + for k=1:rownb + ck=tree.operands(k) + if ck==list("EOL") | typeof(ck)=="comment" then + rowsize=[rowsize 0] + colsize=[colsize 0] + else + rowsize=[rowsize tree.operands(k).dims(1)] + colsize=[colsize tree.operands(k).dims(2)] + if ck.property==Complex then + complexrows=complexrows+1 + end + if ck.property==Real then + realrows=realrows+1 + end + end + end + + if realrows==rownb then + prop=Real + elseif complexrows<>0 then + prop=Complex + else + prop=Unknown + end + + + undef=find(colsize==-1) + void=find(colsize==0) + colsize([undef void])=[] + if colsize==[] then + if undef<>[] then + sc=-1 + else + sc=0 + end + else + [w,k]=min(length(colsize)) + sc=colsize(k) + end + if find(rowsize==-1)==[] then + w=rowsize(1) + for k=2:rownb + w=w+rowsize(k) + end + sr=w + else + sr=-1 + end + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(ck.vtype,prop) + tree.out(1).contents=Contents() +endfunction diff --git a/modules/m2sci/macros/percent/%cc_cell2sci.bin b/modules/m2sci/macros/percent/%cc_cell2sci.bin Binary files differnew file mode 100755 index 000000000..7fc1c3d64 --- /dev/null +++ b/modules/m2sci/macros/percent/%cc_cell2sci.bin diff --git a/modules/m2sci/macros/percent/%cc_cell2sci.sci b/modules/m2sci/macros/percent/%cc_cell2sci.sci new file mode 100755 index 000000000..fe10e2ac2 --- /dev/null +++ b/modules/m2sci/macros/percent/%cc_cell2sci.sci @@ -0,0 +1,66 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function tree=%cc_cell2sci(tree) + + // Make a CELL 'column' with many rows + + if typeof(tree.operands(1))=="funcall" then + if tree.operands(1).name=="cell" then + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + return + end + end + + if tree.operands(1).vtype==Cell then + tree.out(1).infer=tree.operands(1).infer + else + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(1).infer + end + dim1=tree.operands(1).dims(1) + dim2=tree.operands(1).dims(2) + + INFER=list() + if dim2==1 then + INFER(1)=tree.operands(2).infer + else + // Second operand is a rc or a + + op=tree.operands(2) + for kd2=1:dim2-1 + for ki=lstsize(INFER):-1:1 + INFER(ki+1)=INFER(ki) + end + INFER(1)=op.operands(2).infer + op=op.operands(1) + end + for ki=lstsize(INFER):-1:1 + INFER(ki+1)=INFER(ki) + end + INFER(1)=op.infer + end + for kd2=1:dim2 + tree.out(1).contents.index($+1)=list(list(Cste(dim1+1),Cste(kd2)),Cste("entries")) + tree.out(1).contents.data($+1)=INFER(kd2) + tree.out(1).contents.index($+1)=list(Cste(dim1+1),Cste(kd2)) + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),.. + Contents(list(list(list(Cste(1),Cste(1)),Cste("entries"))),list(tree.out(1).contents.data($)))) + end + + + if tree.out(1).dims(1)<>Unknown then + tree.out(1).dims(1)=tree.out(1).dims(1)+1 + end + if tree.out(1).dims(2)==0 then + tree.out(1).dims(2)=tree.out(1).dims(2)+1 + end +endfunction diff --git a/modules/m2sci/macros/percent/%d2sci.bin b/modules/m2sci/macros/percent/%d2sci.bin Binary files differnew file mode 100755 index 000000000..8b7ac6d5d --- /dev/null +++ b/modules/m2sci/macros/percent/%d2sci.bin diff --git a/modules/m2sci/macros/percent/%d2sci.sci b/modules/m2sci/macros/percent/%d2sci.sci new file mode 100755 index 000000000..4c3bee3ab --- /dev/null +++ b/modules/m2sci/macros/percent/%d2sci.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%d2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise right division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab right division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%e2sci.bin b/modules/m2sci/macros/percent/%e2sci.bin Binary files differnew file mode 100755 index 000000000..d1b617ab0 --- /dev/null +++ b/modules/m2sci/macros/percent/%e2sci.bin diff --git a/modules/m2sci/macros/percent/%e2sci.sci b/modules/m2sci/macros/percent/%e2sci.sci new file mode 100755 index 000000000..53233963c --- /dev/null +++ b/modules/m2sci/macros/percent/%e2sci.sci @@ -0,0 +1,177 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%e2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Special case for varargin/varargout + if or(var.name==["varargin","varargout"]) then + ind=tree.operands(2) + if type(ind)<>15 then + tree=Variable(var.name,Infer()) + else + if type(ind(1))==15 | ind(1).vtype<>String then + tree.operands(2)(2)=null() // Del 'entries' + elseif typeof(ind(1))=="cste" then + tree.operands(2)(2)=null() // Del 'entries' + else + tree.operands(2)(1)=null() // Del 'entries' + end + end + return + end + + // Extraction from cells + if var.vtype==Cell then + tree=%e_ce2sci(tree) + return + end + + // Extraction from structs + if var.vtype==Struct then + tree=%e_st2sci(tree) + return + end + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + // --- Recursive extraction --- + if type(ind)==15 then + for kind=1:lstsize(ind) + if type(ind(kind))<>15 then + if ind(kind).vtype==String then + if ind(kind).value=="entries" then + tree.operands(1).vtype=Cell + rhs=rhs+1 + tree=%e_ce2sci(tree) + return + else + tree.operands(1).vtype=Struct + rhs=rhs+1 + tree=%e_st2sci(tree) + return + end + end + end + end + error(msprintf(gettext("recursive extraction from a variable %s of type %s."),var.name,string(var.vtype))) + elseif var.vtype==String then // Character string extraction + tree=Funcall("part",1,Rhs_tlist(var,ind),tree.out) + if is_a_scalar(ind) then + tree.lhs(1).dims=list(1,1) + else + tree.lhs(1).dims=list(1,ind.dims(2)) + end + tree.lhs(1).type=var.type + else // Extraction x(i) + if var.vtype==Unknown then // Unknown type -> can be String + tree=Funcall("mtlb_e",1,Rhs_tlist(var,ind),tree.out) + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=var.type + else + if typeof(ind)=="cste" then + if ind.value==":" then + if var.dims(1)<>Unknown & var.dims(2)<>Unknown then + tree.out(1).dims=list(var.dims(1)*var.dims(2),1) + tree.out(1).type=var.type + else + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + end + return + end + end + + if ind.dims(1)==1 & ind.dims(2)==1 then + tree.out(1).dims=list(1,1) + tree.out(1).type=var.type + elseif var.dims(1)==1 then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=var.type + elseif var.dims(2)==1 then + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + elseif ind.dims(2)==1 then + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + elseif ind.dims(1)==1 then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=var.type + elseif var.dims(1)<>Unknown & var.dims(2)<>Unknown then + tree=Operation(".''",list(tree),tree.out) + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=var.type + else // at leat one dimension unknown + tree=Funcall("mtlb_e",1,Rhs_tlist(var,ind),tree.out) + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=var.type + end + end + end + // No rhs: for example variable display + elseif rhs==0 then + + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimprod=1 + for l=1:size(tree.operands(k).dims) + dimprod=dimprod*tree.operands(k).dims(l) + if dimprod<0 then // Last dimension not known exactly + break + end + end + if is_a_scalar(tree.operands(k)) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + if k<=lstsize(var.dims)+1 then + dims(k-1)=var.dims(k-1); + else + dims(k-1)=Unknown; + end + end + end + elseif dimprod>=0 then + dims(k-1)=dimprod + else + dims(k-1)=Unknown + end + end + + if var.vtype==String then // extraction in strings + if rhs==2 then + rhsarg=Operation("ext",list(var,tree.operands(2)),list()) + tree=Funcall("part",1,Rhs_tlist(rhsarg,tree.operands(3)),tree.out) + tree.lhs(1).dims=list(dims(1:2)) + tree.lhs(1).type=var.type + else + error(gettext("Extraction from strings with more than two indexes not implemented.")) + end + else + tree.out(1).dims=dims + tree.out(1).type=var.type + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%e_ce2sci.bin b/modules/m2sci/macros/percent/%e_ce2sci.bin Binary files differnew file mode 100755 index 000000000..76ef80158 --- /dev/null +++ b/modules/m2sci/macros/percent/%e_ce2sci.bin diff --git a/modules/m2sci/macros/percent/%e_ce2sci.sci b/modules/m2sci/macros/percent/%e_ce2sci.sci new file mode 100755 index 000000000..28b00873e --- /dev/null +++ b/modules/m2sci/macros/percent/%e_ce2sci.sci @@ -0,0 +1,174 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%e_ce2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction from cells + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + + // --- Recursive extraction --- + if type(ind)==15 then + // If last index value is not a fieldname, it is ignored + // it will be considered after all other indexes + // Avoid some extraction problems from character strings + lastisnotfield=typeof(ind($))=="list" + if ~lastisnotfield then + lastisnotfield=ind($).vtype<>String + end + + // Inference + infertree=tree.operands(2) + if lastisnotfield then + infertree($)=null() // Last index is not a fieldname, ignored here + end + + // Change index value if just one double + for k=1:lstsize(infertree) + if typeof(infertree(k))=="cste" | (typeof(infertree(k))<>"list" & is_a_scalar(infertree(k))) then + if infertree(k).vtype<>String then + infertree(k)=list(Cste(1),infertree(k)) + end + end + end + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,infertree); + tree.out(1).dims=tmp.dims + tree.out(1).type=tmp.type + tree.out(1).contents=tmp.contents + end + + // Convert last extraction operation is not already done + if lastisnotfield then + [inftlist,pos]=get_contents_infer(var,infertree) + tmp=gettempvar() + tmp.infer=inftlist + tmp.name=var.name+expression2code(infertree) + + oplist=list() + oplist(1)=tmp + infertree=tree.operands($)($) + if typeof(infertree)<>"list" then + infertree=list(infertree); + end + for k=1:lstsize(infertree) + oplist($+1)=infertree(k) + end + newop=Operation("ext",oplist,tree.out) + rhs=size(newop.operands) + newop=%e2sci(newop) + if typeof(newop)=="operation" then + tree.out(1).dims=newop.out(1).dims + tree.out(1).type=newop.out(1).type + tree.out(1).contents=newop.out(1).contents + else + tree.out(1).dims=newop.lhs(1).dims + tree.out(1).type=newop.lhs(1).type + tree.out(1).contents=newop.lhs(1).contents + end + end + else // Just one index value + tree.out(1).vtype=Cell + + iscste=typeof(ind)=="cste" + iscolon=%F + if iscste then + iscolon=ind.value==":" + end + if ~iscolon & iscste then + tree.out(1).dims=list(1,1) + tree.out(1).contents=Contents() + if tree.operands(1).dims(1)==1 then // row vector + tree.out(1).contents.index(1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data(1)=get_contents_infer(tree.operands(1),list(list(Cste(1),ind),Cste("entries"))) + elseif tree.operands(1).dims(2)==1 then // column vector + tree.out(1).contents.index(1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data(1)=get_contents_infer(tree.operands(1),list(list(ind,Cste(1)),Cste("entries"))) + end + else + tree.out(1).contents=Contents() + if ~iscolon then + tree=Operation("''",list(tree),tree.out) + tree.out(1).dims=ind.dims + else + dprod=1 + for kd=1:lstsize(var.dims) + dprod=dprod*var.dims(kd) + if dprod<0 then + break + end + end + if dprod>0 then + tree.out(1).dims=list(dprod,1) + else + tree.out(1).dims=list(Unknown,1) + end + end + end + + end + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimsum=0 + for l=1:size(tree.operands(k).dims) + dimsum=dimsum+tree.operands(k).dims(l) + end + if dimsum==size(tree.operands(k).dims) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + dims(k-1)=var.dims(k-1) + end + end + else + dims(k-1)=Unknown + end + end + + infertree=tree.operands + infertree(1)=null() + + tree.out(1).type=var.type + tree.out(1).dims=dims + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,list(infertree,Cste("entries"))); + if is_a_scalar(tree.out(1)) then + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tmp + elseif not_a_scalar(tree.out(1)) then + tree.out(1).contents.index($+1)=list(infertree,Cste("entries")) + tree.out(1).contents.data($+1)=tmp + end + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%e_st2sci.bin b/modules/m2sci/macros/percent/%e_st2sci.bin Binary files differnew file mode 100755 index 000000000..2d1a89977 --- /dev/null +++ b/modules/m2sci/macros/percent/%e_st2sci.bin diff --git a/modules/m2sci/macros/percent/%e_st2sci.sci b/modules/m2sci/macros/percent/%e_st2sci.sci new file mode 100755 index 000000000..92e55ecc4 --- /dev/null +++ b/modules/m2sci/macros/percent/%e_st2sci.sci @@ -0,0 +1,155 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%e_st2sci(tree) + // M2SCI function + // Conversion function for Matlab extraction from structs + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_e() + + // Global variable for M2SCI + global("varslist") + + var=tree.operands(1) + + // Do not consider variable as a rhs... + rhs=rhs-1 + + // One index value + if rhs==1 then + ind=tree.operands(2) + + // --- Recursive extraction --- + if type(ind)==15 then + // If last index value is not a fieldname, it is ignored + // it will be considered after all other indexes + // Avoid some extraction problems from character strings + lastisnotfield=typeof(ind($))=="list" + if ~lastisnotfield then + lastisnotfield=ind($).vtype<>String + end + + // Inference + infertree=tree.operands(2) + if lastisnotfield then // Last index is not a fieldname, ignored here + infertree($)=null() + end + // Change index value if just one double + for k=1:lstsize(infertree) + if typeof(infertree(k))=="cste" | (typeof(infertree(k))<>"list" & is_a_scalar(infertree(k))) then + if infertree(k).vtype<>String then + infertree(k)=list(Cste(1),infertree(k)) + end + end + end + + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + tmp=get_contents_infer(var,infertree); + tree.out(1).dims=tmp.dims + tree.out(1).type=tmp.type + tree.out(1).contents=tmp.contents + end + + // Convert last extraction operation is not already done + if lastisnotfield then + [inftlist,pos]=get_contents_infer(var,infertree) + tmp=gettempvar() + tmp.infer=inftlist + varslist($+1)=M2scivar(tmp.name,tmp.name,tmp.infer) + + oplist=list() + oplist(1)=tmp + infertree=tree.operands($)($) + if typeof(infertree)<>"list" & infertree.vtype<>String then + infertree=list(infertree); + end + for k=1:size(infertree) + oplist($+1)=infertree(k) + end + newop=Operation("ext",oplist,tree.out) + rhs=size(newop.operands) + newop=%e2sci(newop) + if typeof(newop)=="operation" then + tree.out(1).dims=newop.out(1).dims + tree.out(1).type=newop.out(1).type + tree.out(1).contents=newop.out(1).contents + else + tree.out(1).dims=newop.lhs(1).dims + tree.out(1).type=newop.lhs(1).type + tree.out(1).contents=newop.lhs(1).contents + end + end + else + // extraction from struct + // this case should happen only if var(ind.value) contains only one value + [bval,index]=isdefinedvar(var) + if ~bval then + error(msprintf(gettext("M2SCI bug: extraction from unknown variable %s in varslist."),var.name)) + else + if varslist(index).vtype<>Struct then + // variable not defined as a struct, modify inference + varslist(index).infer.vtype=Struct + end + end + outdims=list(Unknown,Unknown) + if ind.dims(1)==1 then // a scalar or a vector + outdims=list(1,ind.dims(2)) + end + if typeof(ind)=="cste" | (typeof(ind)<>"list" & is_a_scalar(ind)) then + if ind.vtype<>String then + if var.dims(1)==1 then // row vector + ind=list(Cste(1),ind) + elseif var.dims(2)==1 then // column vector + ind=list(ind,Cste(1)) + end + end + end + if typeof(ind)<>"list" then + ind=list(ind); + end + tree.out(1).infer=get_contents_infer(var,ind) + if tree.out(1).dims==list(Unknown,Unknown) then + tree.out(1).dims=outdims + end + end + // More than one index value + else + dims=list() + for k=2:rhs+1 + dimsum=0 + for l=1:size(tree.operands(k).dims) + dimsum=dimsum+tree.operands(k).dims(l) + end + if dimsum==size(tree.operands(k).dims) // All dims are 1 + dims(k-1)=1 + if typeof(tree.operands(k))=="cste" then + if tree.operands(k).value==":" then + dims(k-1)=var.dims(k-1) + end + end + else + dims(k-1)=Unknown + end + end + + tree.out(1).dims=dims + tree.out(1).type=var.type + + IND=tree.operands + IND(1)=null() // Variable is not an index + + tree.out(1).contents.index($+1)=IND + tree.out(1).contents.data($+1)=get_contents_infer(tree.operands(1),IND) + end +endfunction + diff --git a/modules/m2sci/macros/percent/%g2sci.bin b/modules/m2sci/macros/percent/%g2sci.bin Binary files differnew file mode 100755 index 000000000..df60f7492 --- /dev/null +++ b/modules/m2sci/macros/percent/%g2sci.bin diff --git a/modules/m2sci/macros/percent/%g2sci.sci b/modules/m2sci/macros/percent/%g2sci.sci new file mode 100755 index 000000000..89cf5ad56 --- /dev/null +++ b/modules/m2sci/macros/percent/%g2sci.sci @@ -0,0 +1,69 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%g2sci(tree) + // M2SCI function + // Conversion function for Matlab logical OR + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_g_s.sci + // - %s_g_b.sci + // These functions are not used to get the same output value as Matlab one with empty matrices + + // %s_g_s is also defined but no more used (hard coded) + + [A,B] = getoperands(tree) + + // Short circuiting OR + if (typeof(B)=="variable" & B.name=="%shortcircuit") then + if typeof(tree.out(1))=="variable" & tree.out(1).name=="ans" then + tmp=gettempvar() + tmp.type=Type(Boolean,Real) + tree=tmp + else + tmp=tree.out(1) + global("varslist") + varslist($+1)=M2scivar(tree.out(1).name,tree.out(1).name,Infer(list(1,1),Type(Boolean,Real))) + tree=list() + end + insert(Equal(list(tmp),Cste(%T))) + insert(tlist(["ifthenelse","expression","then","elseifs","else"],Operation("~",list(A.operands(1)),list()),list(Equal(list(tmp),A.operands(2))),list(),list())) + return + end + + // To have good size for result with String as input + // And overloading functions are not written for Strings + if A.vtype==Unknown | A.vtype==String then + A = convert2double(A) + end + if B.vtype==Unknown | B.vtype==String then + B = convert2double(B) + end + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + // If A is a scalar + if is_a_scalar(A) then + tree.out(1).dims=B.dims + // If B is a scalar + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + // If A or B is an empty matrix + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=A.dims + // A and B are not scalars and not empty matrices -> they have the same size + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction diff --git a/modules/m2sci/macros/percent/%h2sci.bin b/modules/m2sci/macros/percent/%h2sci.bin Binary files differnew file mode 100755 index 000000000..a24697373 --- /dev/null +++ b/modules/m2sci/macros/percent/%h2sci.bin diff --git a/modules/m2sci/macros/percent/%h2sci.sci b/modules/m2sci/macros/percent/%h2sci.sci new file mode 100755 index 000000000..4a43049aa --- /dev/null +++ b/modules/m2sci/macros/percent/%h2sci.sci @@ -0,0 +1,69 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%h2sci(tree) + // M2SCI function + // Conversion function for Matlab logical AND + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_h_s.sci + // - %s_h_b.sci + // These functions are not used to get the same output value as Matlab one with empty matrices + + // %s_h_s is also defined but no more used (hard coded) + + [A,B]=getoperands(tree) + + // Short circuiting AND + if (typeof(B)=="variable" & B.name=="%shortcircuit") then + if typeof(tree.out(1))=="variable" & tree.out(1).name=="ans" then + tmp=gettempvar() + tmp.type=Type(Boolean,Real) + tree=tmp + else + tmp=tree.out(1) + global("varslist") + varslist($+1)=M2scivar(tree.out(1).name,tree.out(1).name,Infer(list(1,1),Type(Boolean,Real))) + tree=list() + end + insert(Equal(list(tmp),Cste(%F))) + insert(tlist(["ifthenelse","expression","then","elseifs","else"],A.operands(1),list(Equal(list(tmp),A.operands(2))),list(),list())) + return + end + + // To have good size for result with String as input + // And overloading functions are not written for Strings + if A.vtype==Unknown | A.vtype==String then + A = convert2double(A) + end + if B.vtype==Unknown | B.vtype==String then + B = convert2double(B) + end + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + // If A is a scalar + if is_a_scalar(A) then + tree.out(1).dims=B.dims + // If B is a scalar + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + // If A or B is an empty matrix + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=A.dims + // A and B are not scalars and not empty matrices -> they have the same size + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction diff --git a/modules/m2sci/macros/percent/%i2sci.bin b/modules/m2sci/macros/percent/%i2sci.bin Binary files differnew file mode 100755 index 000000000..d37d833ec --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci.bin diff --git a/modules/m2sci/macros/percent/%i2sci.sci b/modules/m2sci/macros/percent/%i2sci.sci new file mode 100755 index 000000000..27a69605a --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci.sci @@ -0,0 +1,190 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation functions: mtlb_i() and mtlb_is() + + // Global variable for M2SCI + global("varslist") + + from=tree.operands($) + to=tree.operands(1) + + // Special case for varargin/varargout + if or(to.name==["varargin","varargout"]) then + ind=tree.operands(2) + if type(ind)<>15 then + tree=Variable(to.name,Infer()) + else + if type(ind(1))==15 | ind(1).vtype<>String then + tree.operands(2)(2)=null() // Del 'entries' + elseif typeof(ind(1))=="cste" then + tree.operands(2)(2)=null() // Del 'entries' + else + tree.operands(2)(1)=null() // Del 'entries' + end + end + return + end + + + // Ajust rhs value (variable and value to insert are part of rhs) + rhs=rhs-2 + + // Insertion with cells + if to.vtype==Cell | from.vtype==Cell then + tree=%i_ce2sci(tree) + return + end + + // Insertion with structs + if to.vtype==Struct | from.vtype==Struct then + tree=%i_st2sci(tree) + return + end + + // Just one index value + if rhs==1 then + ind=tree.operands(2) + // --- Insertion of strings --- + if to.vtype==String & from.vtype==String then + tree=list() + to.dims=allunknown(to.dims) + [bval,index]=isdefinedvar(to) + if bval then + varslist(index).infer.dims=allunknown(to.dims) + end + insert(Equal(list(to),Funcall("mtlb_is",1,Rhs_tlist(to,from,ind),list(to))),1) + // --- Insertion with just one index --- + elseif type(ind)<>15 then + if ind.vtype==String then + if typeof(ind)=="cste" then + if ind.value<>":" then + tree=%i_st2sci(tree) + return + end + end + end + + iscste=typeof(ind)=="cste" + iscolon=%F + if iscste then + iscolon=ind.value==":" + end + + // --- Insertion with just one index which is not : --- + if ~iscolon then + if is_empty(to) then // Insertion in an empty matrix + if typeof(ind)=="cste" then + tree.out(1).dims=list(1,ind.value) + else + tree.out(1).dims=list(1,Unknown) + end + tree.out(1).type=to.type + tree=%i2sci_s(tree) + else + if is_a_scalar(to) then + tree=%i2sci_s(tree) + elseif is_a_vector(to) & to.dims(2)<>1 then + tree=%i2sci_r(tree) + elseif is_a_vector(to) & to.dims(1)<>1 then + tree=%i2sci_c(tree) + else + tree=%i2sci_g(tree) + return + end + end + // --- Insertion with just one index which is : --- + else + if is_empty(to) then // Insertion in an empty matrix + if from.dims(2)<>1 then + if typeof(from)=="variable" then + if isdefinedvar(from) then + break + end + end + insert(Equal(list(to),list(from))) + end + end + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=to.type + end + // --- Insertion with more than one index value (index is a list) --- + else + indexisstr=%F + iscell=%F + for k=1:lstsize(ind) + if type(ind(k))<>15 then + if ind(k).vtype==String then + if typeof(ind(k))=="cste" & ind(k).value=="entries" then + iscell=%T + else + indexisstr=%T + end + end + end + end + if iscell then + tree=%i_ce2sci(tree) + return + end + if indexisstr then + tree=%i_st2sci(tree) + return + end + error(msprintf(gettext("recursive insertion in a variable which is not a Cell nor a Struct: %s."),to.name)) + end + // Two indexes: to(ind1,ind2,...)=from or more + else + if to.vtype==String & from.vtype==String then + tree=list() + to.dims=allunknown(to.dims) + [bval,index]=isdefinedvar(to) + if bval then + varslist(index).infer.dims=allunknown(to.dims) + end + insert(Equal(list(to),Funcall("mtlb_is",1,Rhs_tlist(to,from,tree.operands(2),tree.operands(3)),list(to))),1) + else + tree.out(1).dims=list() + for k=1:lstsize(tree.operands)-2 + tree.out(1).dims(k)=Unknown + end + // dim can be infered when index is a constant and when index value is greater than older dim and this dim is not unknown + for kdim=1:size(tree.operands)-2 + if typeof(tree.operands(kdim+1))=="cste" & tree.operands(kdim+1).vtype<>String then + if to.dims(kdim)<>Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + if is_empty(to) then + // a(k,:)=b with a==[] is converted by a(1,1:length(b))=b + if lstsize(tree.operands)-2 == 2 & typeof(tree.operands($-1))=="cste" & tree.operands($-1).value==":" then + length_funcall=Funcall("length",1,Rhs_tlist(tree.operands($)),list()) + tree.operands($-1)=Operation(":",list(Cste(1),length_funcall),list()) + end + // a(:,k)=b with a==[] is converted by a(1:length(b),1)=b + if lstsize(tree.operands)-2 == 2 & typeof(tree.operands($-2))=="cste" & tree.operands($-2).value==":" then + length_funcall=Funcall("length",1,Rhs_tlist(tree.operands($)),list()) + tree.operands($-2)=Operation(":",list(Cste(1),length_funcall),list()) + end + end + tree.out(1).type=from.type + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%i2sci_c.bin b/modules/m2sci/macros/percent/%i2sci_c.bin Binary files differnew file mode 100755 index 000000000..e64c6b345 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_c.bin diff --git a/modules/m2sci/macros/percent/%i2sci_c.sci b/modules/m2sci/macros/percent/%i2sci_c.sci new file mode 100755 index 000000000..344bf6db1 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_c.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i2sci_c(tree) + // M2SCI function + // Conversion function for Matlab insertion in column vectors (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + if from.dims(1)==1 & from.dims(2)==1 then // Insert a scalar + elseif from.dims(2)==1 then // Insert a row vector + elseif from.dims(1)<>Unknown & from.dims(2)<>Unknown then // Insert a matrix with known sizes + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list()))) + else + if ~isdefinedvar(from) then + w=gettempvar() + insert(Equal(list(w),from)) + else + w=from + end + + // from=from(:)' + tmp=Operation("ext",list(w,Cste(":")),list()) + tmp=Operation("''",list(tmp),list()) + + tree.operands(4)=tmp + tree.operands(3)=Cste(1) + tree.operands(2)=ind + end + + // Data inference + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=to.type +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_g.bin b/modules/m2sci/macros/percent/%i2sci_g.bin Binary files differnew file mode 100755 index 000000000..60452b3ff --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_g.bin diff --git a/modules/m2sci/macros/percent/%i2sci_g.sci b/modules/m2sci/macros/percent/%i2sci_g.sci new file mode 100755 index 000000000..380e6200e --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_g.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i2sci_g(tree) + // M2SCI function + // Conversion function for Matlab insertion in matrices (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + newtree=Funcall("mtlb_i",1,Rhs_tlist(to,ind,from),list(to)) + insert(Equal(list(to),newtree)) + tree=list() +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_r.bin b/modules/m2sci/macros/percent/%i2sci_r.bin Binary files differnew file mode 100755 index 000000000..e0afc88fe --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_r.bin diff --git a/modules/m2sci/macros/percent/%i2sci_r.sci b/modules/m2sci/macros/percent/%i2sci_r.sci new file mode 100755 index 000000000..37f132275 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_r.sci @@ -0,0 +1,46 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i2sci_r(tree) + // M2SCI function + // Conversion function for Matlab insertion in row vectors (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + if from.dims(1)==1 & from.dims(2)==1 then // Insert a scalar + elseif from.dims(1)==1 then // Insert a row vector + elseif from.dims(1)<>Unknown & from.dims(2)<>Unknown then // Insert a matrix with known sizes + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list()))) + else + if ~isdefinedvar(from) then + w=gettempvar() + insert(Equal(list(w),from)) + else + w=from + end + + // from=from(:).' + tmp=Operation("ext",list(w,Cste(":")),list()) + tmp=Operation(".''",list(tmp),list()) + + tree.operands(4)=tmp + tree.operands(3)=ind + tree.operands(2)=Cste(1) + end + + // Data inference + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=to.type +endfunction + + diff --git a/modules/m2sci/macros/percent/%i2sci_s.bin b/modules/m2sci/macros/percent/%i2sci_s.bin Binary files differnew file mode 100755 index 000000000..af23a49dc --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_s.bin diff --git a/modules/m2sci/macros/percent/%i2sci_s.sci b/modules/m2sci/macros/percent/%i2sci_s.sci new file mode 100755 index 000000000..e73361fc1 --- /dev/null +++ b/modules/m2sci/macros/percent/%i2sci_s.sci @@ -0,0 +1,33 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i2sci_s(tree) + // M2SCI function + // Conversion function for Matlab insertion in scalars (called by %i2sci()) + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + ind=tree.operands(2) + + tree.operands(2)=list(Cste(1),ind) + if ~is_a_scalar(from) & from.dims(1)<>1 then + tree.operands($)=Funcall("matrix",1,Rhs_tlist(from,1,Operation("-",list(Cste(1)),list())),list()) + end + + // Data inference + if typeof(ind)=="cste" then + tree.out(1).dims=list(1,ind.value) + else + tree.out(1).dims=list(1,Unknown) + end + tree.out(1).type=to.type +endfunction + diff --git a/modules/m2sci/macros/percent/%i_ce2sci.bin b/modules/m2sci/macros/percent/%i_ce2sci.bin Binary files differnew file mode 100755 index 000000000..b224be906 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_ce2sci.bin diff --git a/modules/m2sci/macros/percent/%i_ce2sci.sci b/modules/m2sci/macros/percent/%i_ce2sci.sci new file mode 100755 index 000000000..2c3fbcd89 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_ce2sci.sci @@ -0,0 +1,172 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i_ce2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion in cells + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + from=tree.operands($) + to=tree.operands(1) + // Verify that to is not a struct (cell of struct) + inds=tree.operands;inds(1)=null();inds($)=null() + if type(inds)<>15 then + inds=list(inds) + end + for kinds=1:lstsize(inds) + if typeof(inds(kinds))<>"list" & inds(kinds).vtype==String & typeof(inds(kinds))=="cste" & inds(kinds).value<>":" then + tree=%i_st2sci(tree) + return + end + end + + if to.vtype<>Struct then + if and(to.vtype<>[Cell,Unknown]) then + if to.vtype==Double & and(to.dims==list(0,0)) then + insert(Equal(list(to),Funcall("cell",1,list(),list(to)))) + // To be sure that variable will now be of type Cell + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Cell + else + error(msprintf(gettext("destination variable is not a cell: %s is of type %s."),to.name,string(to.vtype))) + end + elseif to.vtype==Unknown then + insert(Equal(list(to),Funcall("cell",1,list(),list(to)))) + // To be sure that variable will now be of type Cell + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Cell + end + end + // Just one index value + if rhs==1 then + ind=tree.operands(2) + if type(ind)<>15 then // One value index A(xx)={...} + tree.operands(2)=list(Cste(1),ind) + tree.out(1).vtype=Cell + if typeof(ind)=="cste" then + if ind.vtype<>String then // Not : + tree.out(1).dims=list(1,ind.value) + + // Data added so that extraction of a cell element can also be infered + tree.out(1).contents.index($+1)=tree.operands(2) + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),from.contents) + + if lstsize(from.contents.data)==1 then + tree.out(1).contents.index($+1)=list(tree.operands(2),Cste("entries")) + tree.out(1).contents.data($+1)=from.contents.data(1) + else + error(gettext("Not yet implemented.")) + end + else + tree.out(1).infer=from.infer + end + else + tree.out(1).dims=list(1,Unknown) + end + else // --- Insertion with more than one index value (index is a list) --- + // Cell array of struct A{p,q,...}.name... or recursive index A{p,q,...}(1,2)... + for kind=1:lstsize(tree.operands(2)) + if typeof(tree.operands(2)(kind))=="cste" then + if tree.operands(2)(kind).vtype<>String then + tree.operands(2)(kind)=list(Cste(1),tree.operands(2)(kind)) + end + end + end + IND=tree.operands(2)(1) + // Update cell dims for inference + if typeof(IND)=="list" then + if lstsize(IND)>lstsize(tree.out(1).dims) then + for kd=lstsize(tree.out(1).dims):lstsize(IND) + tree.out(1).dims(kd)=Unknown + end + end + for kd=1:lstsize(tree.out(1).dims) + if typeof(IND(kd))=="cste" & tree.out(1).dims(kd)<>Unknown & tree.out(1).dims(kd)<IND(kd).value then + tree.out(1).dims(kd)=IND(kd).value + end + end + else + tree.out(1).dims=list(1,1) + end + tree.out(1).type=Type(Cell,Unknown) + + ind=tree.operands(2) + if typeof(ind($))=="list" | ind($).vtype~=String then // X.p(m,n)=y + tmp=gettempvar() + oplist=list() + + tmpind=ind + tmpind($)=null() + if or(get_contents_infer(tree.operands(1),tmpind)<>Infer()) then + tmp.infer=get_contents_infer(tree.operands(1),tmpind) + end + oplist(1)=tmp + + for kind=1:size(ind($)) + oplist($+1)=ind($)(kind) + end + + oplist($+1)=tree.operands($) + + newop=Operation("ins",oplist,list(tmp)) + newop=%i2sci(newop) + tree.out(1).infer.contents.index($+1)=tmpind + tree.out(1).infer.contents.data($+1)=newop.out(1).infer + elseif ind($).vtype==String then + tree.out(1).type=Type(Struct,Unknown) + end + + // Update cell contents + infertree=tree.operands(2) + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=from.infer + end + // Two indexes: to(ind1,ind2,...)=from or more + else + tree.out(1).dims=list() + for k=1:lstsize(tree.operands)-2 + tree.out(1).dims(k)=Unknown + end + + // dim can be infered when index is a constant and when index value is greater than older dim and this dim is not unknown + for kdim=1:size(tree.operands)-2 + if typeof(tree.operands(kdim+1))=="cste" then + if to.dims(kdim)<>Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + tree.out(1).type=from.type + + // Update contents... + infertree=tree.operands + infertree(1)=null() + infertree($)=null() + + // Data added so that extraction of a cell element can also be infered + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Cell,Unknown),Contents()) + + infertree=list(infertree,Cste("entries")) + if lstsize(from.contents.index)==1 then + tree.out(1).contents.index($+1)=infertree + tree.out(1).contents.data($+1)=from.contents.data(1); + elseif lstsize(from.contents.index)==0 then + tree.out(1).contents=Contents() + else + error(gettext("Not yet implemented.")) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%i_st2sci.bin b/modules/m2sci/macros/percent/%i_st2sci.bin Binary files differnew file mode 100755 index 000000000..c2d15c7c8 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_st2sci.bin diff --git a/modules/m2sci/macros/percent/%i_st2sci.sci b/modules/m2sci/macros/percent/%i_st2sci.sci new file mode 100755 index 000000000..9ce57cac7 --- /dev/null +++ b/modules/m2sci/macros/percent/%i_st2sci.sci @@ -0,0 +1,191 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%i_st2sci(tree) + // M2SCI function + // Conversion function for Matlab insertion in structs + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation functions: mtlb_i() and mtlb_is() + + // Global variable for M2SCI + global("varslist") + + from=tree.operands($) + to=tree.operands(1) + + // Insertion of a struct in a not-struct array + if typeof(to)=="variable" & to.vtype<>Struct then + // To be sure that variable will now be of type Struct + [bval,index]=isdefinedvar(to) + varslist(index).infer.type.vtype=Struct + varslist(index).infer.contents=Contents() + tree.out(1).infer=Infer(list(0,0),Type(Struct,Unknown),Contents()) + elseif typeof(to)=="operation" & to.vtype<>Struct then + // To be sure that variable will now be of type Struct + [bval,index]=isdefinedvar(to.operands(1)) + varslist(index).infer.type.vtype=Struct + varslist(index).infer.contents=Contents() + tree.out(1).infer=Infer(list(0,0),Type(Struct,Unknown),Contents()) + end + + // Just one index value + if rhs==1 then + ind=tree.operands(2) + // --- Insertion with just one index --- + if type(ind)<>15 then + // --- Insertion in a struct with just one index --- + if ind.vtype==String then // A.f + tree.out(1).dims=list(1,1); + tree.out(1).vtype=Struct + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),ind) + tree.out(1).contents.data($+1)=from.infer + else + if from.vtype<>Double then // X(p)=struct(...) + tree.operands(2)=list(Cste(1),tree.operands(2)) + tree.out(1).vtype=Struct + if typeof(ind)=="cste" then + if ind.vtype<>String then // Not : + tree.out(1).dims=list(1,ind.value) + + tree.out(1).contents.index($+1)=list(Cste(1),ind) + + // Update contents for an extraction of type: z = X(p) + CONT=Contents() + for k=1:lstsize(from.infer.contents.index) + if type(from.contents.index(k)(1))==15 then + CONT.index($+1)=list(from.contents.index(k)(2)) + else + CONT.index($+1)=list(from.contents.index(k)) + end + CONT.data($+1)=from.contents.data(k) + end + tree.out(1).contents.data($+1)=Infer(list(1,1),Type(Struct,Unknown),CONT) + + // Update contents for extraction of type: z = X(p).f + for k=1:lstsize(from.infer.contents.index) + if type(from.contents.index(k)(1))==15 then + tree.out(1).contents.index($+1)=list(list(Cste(1),ind),from.contents.index(k)(2)) + else + tree.out(1).contents.index($+1)=list(list(Cste(1),ind),from.contents.index(k)) + end + tree.out(1).contents.data($+1)=from.contents.data(k) + end + else + tree.out(1).dims=from.dims + tree.out(1).contents=from.contents + end + end + else + if is_empty(from) then // Clear element: A(p)=[] + // Nothing done + else // Change type of variable + error(gettext("Not yet implemented.")) + end + end + end + // --- Insertion with more than one index value (index is a recursive index list) --- + else + + // Change index value if just one double + for k=1:lstsize(ind) + //ind(k+1) <-> tree.operands(2)(k+1) + if typeof(ind(k))=="cste" | (typeof(ind(k))<>"list" & is_a_scalar(ind(k))) then + if ind(k).vtype<>String then + tree.operands(2)(k)=list(Cste(1),tree.operands(2)(k)) + end + end + end + ind=tree.operands(2); + + if typeof(ind($))=="list" | ind($).vtype~=String then // X.p(m,n)=y + tmp=gettempvar() + oplist=list() + + tmpind=ind + tmpind($)=null() + if or(get_contents_infer(tree.operands(1),tmpind)<>Infer()) then + tmp.infer=get_contents_infer(tree.operands(1),tmpind) + end + oplist(1)=tmp + + for kind=1:size(ind($)) + oplist($+1)=ind($)(kind) + end + + oplist($+1)=tree.operands($) + + newop=Operation("ins",oplist,list(tmp)) + newop=%i2sci(newop) + tree.out(1).infer.contents.index($+1)=tmpind + tree.out(1).infer.contents.data($+1)=newop.out(1).infer + end + + infertree=tree.operands(2) + + // A(x,y,...).f + if typeof(infertree(1))=="list" then + possible_dims=infertree(1) + infdims=tree.out(1).dims + if lstsize(infdims)<lstsize(possible_dims) then + for k=lstsize(infdims)+1:lstsize(possible_dims) + infdims(k)=Unknown + end + end + for k=1:lstsize(possible_dims) + if typeof(possible_dims(k))<>"cste" then + infdims(k)=Unknown + elseif infdims(k)<>Unknown & infdims(k)<possible_dims(k).value then + infdims(k)=possible_dims(k).value + end + end + tree.out(1).infer.contents.index($+1)=ind + tree.out(1).infer.contents.data($+1)=from.infer + tree.out(1).dims=infdims + tree.out(1).type=Type(Struct,Unknown) + // A.b.f + else + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Struct,Unknown) + tree.out(1).infer.contents.index($+1)=ind + tree.out(1).infer.contents.data($+1)=from.infer + end + + end + // Two indexes: to(ind1,ind2,...)=from or more + else + tree.out(1).dims=list() + for k=1:lstsize(tree.operands)-2 + tree.out(1).dims(k)=Unknown + end + + // dim can be infered when index is a constant and when index value is greater than older dim and this dim is not unknown + for kdim=1:size(tree.operands)-2 + if typeof(tree.operands(kdim+1))=="cste" then + if to.dims(kdim)<>Unknown then + if to.dims(kdim)<=tree.operands(kdim+1).value then + tree.out(1).dims(kdim)=tree.operands(kdim+1).value; + else + tree.out(1).dims(kdim)=to.dims(kdim) + end + end + end + end + tree.out(1).type=from.type + + // Update contents + ind=tree.operands + ind(1)=null() + ind($)=null() + tree.out(1).infer.contents.index($+1)=ind + tree.out(1).infer.contents.data($+1)=from.infer + + end +endfunction + diff --git a/modules/m2sci/macros/percent/%imp2sci.bin b/modules/m2sci/macros/percent/%imp2sci.bin Binary files differnew file mode 100755 index 000000000..f9e630c8c --- /dev/null +++ b/modules/m2sci/macros/percent/%imp2sci.bin diff --git a/modules/m2sci/macros/percent/%imp2sci.sci b/modules/m2sci/macros/percent/%imp2sci.sci new file mode 100755 index 000000000..cfe706810 --- /dev/null +++ b/modules/m2sci/macros/percent/%imp2sci.sci @@ -0,0 +1,83 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%imp2sci(tree) + // M2SCI function + // Conversion function for Matlab colon + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_imp() + + // A:B + if size(tree.operands)==2 then + + // Convert all inputs to double because Matlab also accept Strings... + [A,B] = getoperands(tree) + + if A.vtype<>String then + A = convert2double(A) + end + if B.vtype<>String then + B = convert2double(B) + end + tree.operands=list(A,B) + + if is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("One operand is an empty matrix in : %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + tree.dims=list(1,0) + elseif not_empty(A) & not_empty(B) then + tree.out(1).type=Type(Double,Real) + if and([A.vtype,B.vtype]==String) then + tree.out(1).dims=list(1,size(asciimat(A.value):asciimat(B.value),"*")) + tree.out(1).type=Type(String,Real) + elseif and([typeof(A),typeof(B)]=="cste") then + tree.out(1).dims=list(1,size(A.value:B.value,"*")) + else + tree.out(1).dims=list(1,Unknown) + end + else + tree=Funcall("mtlb_imp",1,list(A,B),tree.out) + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + // A:inc:B + else + + // Convert all inputs to double because Matlab also accept Strings... + [A,inc,B]=getoperands(tree) + if A.vtype<>String then + A = convert2double(A) + end + if B.vtype<>String then + B = convert2double(B) + end + if inc.vtype<>String then + inc = convert2double(inc) + end + tree.operands=list(A,inc,B) + + if is_empty(A) | is_empty(B) | is_empty(inc) then + set_infos(msprintf(gettext("One operand is an empty matrix in : %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + tree.dims=list(1,0) + elseif not_empty(A) & not_empty(B) & not_empty(inc) then + tree.out(1).dims=list(1,Unknown) + tree.out(1).type=Type(Double,Real) + else + tree=Funcall("mtlb_imp",1,list(A,inc,B),tree.out) + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + if and([A.vtype,B.vtype]==String) then + tree.out(1).type=Type(String,Real) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%j2sci.bin b/modules/m2sci/macros/percent/%j2sci.bin Binary files differnew file mode 100755 index 000000000..6615840fa --- /dev/null +++ b/modules/m2sci/macros/percent/%j2sci.bin diff --git a/modules/m2sci/macros/percent/%j2sci.sci b/modules/m2sci/macros/percent/%j2sci.sci new file mode 100755 index 000000000..a8d11d79e --- /dev/null +++ b/modules/m2sci/macros/percent/%j2sci.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%j2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise exponent + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab exponent does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + // Output can be Complex or Real whatever are the inputs + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%l2sci.bin b/modules/m2sci/macros/percent/%l2sci.bin Binary files differnew file mode 100755 index 000000000..9adf49a8f --- /dev/null +++ b/modules/m2sci/macros/percent/%l2sci.bin diff --git a/modules/m2sci/macros/percent/%l2sci.sci b/modules/m2sci/macros/percent/%l2sci.sci new file mode 100755 index 000000000..bf2966709 --- /dev/null +++ b/modules/m2sci/macros/percent/%l2sci.sci @@ -0,0 +1,52 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%l2sci(tree) + // M2SCI function + // Conversion function for Matlab left division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_l() + + [A,B] = getoperands(tree) + + // We have to call mtlb_l() for strings because result is computed with transposed strings... + if or(A.vtype==[String,Unknown]) & or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_l",1,list(A,B),tree.out) + tree.lhs(1).dims=allunknown(A.dims) + if A.vtype==String & B.vtype==String then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + else + // Boolean -> Double + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=list(A.dims(2),B.dims(2)) + end + end +endfunction + diff --git a/modules/m2sci/macros/percent/%log2sci.bin b/modules/m2sci/macros/percent/%log2sci.bin Binary files differnew file mode 100755 index 000000000..6b8ca6753 --- /dev/null +++ b/modules/m2sci/macros/percent/%log2sci.bin diff --git a/modules/m2sci/macros/percent/%log2sci.sci b/modules/m2sci/macros/percent/%log2sci.sci new file mode 100755 index 000000000..3bf545d3c --- /dev/null +++ b/modules/m2sci/macros/percent/%log2sci.sci @@ -0,0 +1,59 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%log2sci(tree) + // M2SCI function + // Conversion function for Matlab logical operators + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_logic() + + [A,B]=getoperands(tree) + A=convert2double(A) + B=convert2double(B) + + // Special case for nargout + if typeof(A)=="variable" & typeof(B)=="cste" then + if A.name=="nargout" & B.value==0 then + B=Cste(1) + end + end + if typeof(B)=="variable" & typeof(A)=="cste" then + if B.name=="nargout" & A.value==0 then + A=Cste(1) + end + end + + tree.operands=list(A,B) + + tree.out(1).type=Type(Boolean,Real) + + // Scilab operators >, <, >= and <= do not work with complex values + if or(tree.operator==["<", ">", "<=", ">="]) & (~is_real(A) | ~is_real(B)) then + tree=Funcall("mtlb_logic",1,list(A,Cste(tree.operator),B),tree.out) + tree.lhs(1).dims=A.dims + else + // Cases with empty matrix + if is_empty(A) | is_empty(B) then + // For >, <, >= and <= : Scilab gives an error message if both operands are [] + // For == and ~= : Scilab returns %T or %F + set_infos(msprintf(gettext("At least one operand is an empty matrix for operator: %s, result set to []."),expression2code(tree)),1); + tree=Cste([]) + elseif is_a_scalar(A) & not_empty(B) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) & not_empty(A) then + tree.out(1).dims=A.dims + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=A.dims + else + tree=Funcall("mtlb_logic",1,list(A,Cste(tree.operator),B),tree.out) + tree.lhs(1).dims=A.dims + end + end +endfunction diff --git a/modules/m2sci/macros/percent/%m2sci.bin b/modules/m2sci/macros/percent/%m2sci.bin Binary files differnew file mode 100755 index 000000000..e23a280f2 --- /dev/null +++ b/modules/m2sci/macros/percent/%m2sci.bin diff --git a/modules/m2sci/macros/percent/%m2sci.sci b/modules/m2sci/macros/percent/%m2sci.sci new file mode 100755 index 000000000..12a2b3aeb --- /dev/null +++ b/modules/m2sci/macros/percent/%m2sci.sci @@ -0,0 +1,75 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%m2sci(tree) + // M2SCI function + // Conversion function for Matlab multiplication + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_m_s.sci + // - %s_m_b.sci + + [A,B]=getoperands(tree) + + // Multiplication does not work with Strings in Scilab + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_m_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean then + B=convert2double(B) + end + tree.operands=list(A,B) + + if is_complex(A) & is_complex(B) then + prop=Unknown + elseif A.property==Complex | B.property==Complex then + if not_empty(A) & not_empty(B) then + prop=Complex + elseif is_empty(A) | is_empty(B) then + prop=Real + else + prop=Unknown + end + elseif is_real(A) & is_real(B) then + prop=Real + else + prop=Unknown + end + + tree.out(1).type=Type(Double,prop) + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + elseif not_a_scalar(A) & not_a_scalar(B) then + // A and B have the same dimensions + tree.out(1).dims=A.dims; + for kk=1:size(B.dims) + if B.dims<>Unknown then + tree.out(1).dims(kk) = B.dims(kk); + end + end + elseif not_empty(A) & not_empty(B) then + tree.out(1).dims=list(A.dims(1),B.dims(2)) + elseif is_empty(A) | is_empty(B) then + tree.out(1).dims=list(0,0) + elseif not_empty(A) | not_empty(B) then + tree.out(1).dims=list(A.dims(1),B.dims(2)) + else + tree.out(1).dims=list(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/percent/%p2sci.bin b/modules/m2sci/macros/percent/%p2sci.bin Binary files differnew file mode 100755 index 000000000..821c5a0d5 --- /dev/null +++ b/modules/m2sci/macros/percent/%p2sci.bin diff --git a/modules/m2sci/macros/percent/%p2sci.sci b/modules/m2sci/macros/percent/%p2sci.sci new file mode 100755 index 000000000..315ec4ae5 --- /dev/null +++ b/modules/m2sci/macros/percent/%p2sci.sci @@ -0,0 +1,42 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%p2sci(tree) + // M2SCI function + // Conversion function for Matlab exponent + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Warning: Matlab bug for p^X when p is a character ! + + [A,B] = getoperands(tree) + + // Scilab exponent does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + // Output can be Complex or Real whatever are the inputs + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=allunknown(A.dims) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%q2sci.bin b/modules/m2sci/macros/percent/%q2sci.bin Binary files differnew file mode 100755 index 000000000..1b47eb7ca --- /dev/null +++ b/modules/m2sci/macros/percent/%q2sci.bin diff --git a/modules/m2sci/macros/percent/%q2sci.sci b/modules/m2sci/macros/percent/%q2sci.sci new file mode 100755 index 000000000..74173fe3e --- /dev/null +++ b/modules/m2sci/macros/percent/%q2sci.sci @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%q2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise left division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab left division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%r2sci.bin b/modules/m2sci/macros/percent/%r2sci.bin Binary files differnew file mode 100755 index 000000000..2f016d7b0 --- /dev/null +++ b/modules/m2sci/macros/percent/%r2sci.bin diff --git a/modules/m2sci/macros/percent/%r2sci.sci b/modules/m2sci/macros/percent/%r2sci.sci new file mode 100755 index 000000000..45a1b66e0 --- /dev/null +++ b/modules/m2sci/macros/percent/%r2sci.sci @@ -0,0 +1,42 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%r2sci(tree) + // M2SCI function + // Conversion function for Matlab right division + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + [A,B] = getoperands(tree) + + // Scilab right division does not work with Strings, Booleans... + A = convert2double(A) + B = convert2double(B) + + tree.operands=list(A,B) + + if is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + elseif (is_real(A) & is_complex(B)) | (is_real(B) & is_complex(A)) then + tree.out(1).type=Type(Double,Complex) + else + tree.out(1).type=Type(Double,Unknown) + end + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + // Dimensions are Unknown because can be (1,1) if both operands are equal... + tree.out(1).dims=list(Unknown,Unknown) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%rc2sci.bin b/modules/m2sci/macros/percent/%rc2sci.bin Binary files differnew file mode 100755 index 000000000..ab090f738 --- /dev/null +++ b/modules/m2sci/macros/percent/%rc2sci.bin diff --git a/modules/m2sci/macros/percent/%rc2sci.sci b/modules/m2sci/macros/percent/%rc2sci.sci new file mode 100755 index 000000000..451ab030f --- /dev/null +++ b/modules/m2sci/macros/percent/%rc2sci.sci @@ -0,0 +1,97 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%rc2sci(tree) + + // Make a 'row' with many columns + + if tree.operands(1).vtype==Cell then + tree=%rc_cell2sci(tree) + return + end + + colnb=size(tree.operands) + row=list() + rowsize=[] + colsize=[] + typ=Double + + realcols=0 + complexcols=0 + + for k=1:colnb + rk=tree.operands(k) + row(k)=rk + if rk.vtype==String then + typ=String + end + rowsize=[rowsize tree.operands(k).dims(1)] + colsize=[colsize tree.operands(k).dims(2)] + if rk.property==Complex then + complexcols=complexcols+1 + end + if rk.property==Real then + realcols=realcols+1 + end + end + + if realcols==colnb then + prop=Real + elseif complexcols<>0 then + prop=Complex + else + prop=Unknown + end + + undef=find(rowsize==-1) + void=find(rowsize==0) + rowsize([undef void])=[] + if rowsize==[] then + if undef<>[] then + sr=-1 + else + sr=0 + end + else + [w,k]=min(length(rowsize)) + sr=rowsize(k) + end + + if typ<>String then + if find(colsize==-1)==[] then + w=colsize(1) + for k=2:colnb + w=w+colsize(k) + end + sc=w + else + sc=-1 + end + + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(rk.vtype,prop) + else + if find(colsize==-1)==[] then + w=colsize(1) + for k=2:colnb + w=w+colsize(k) + end + sc=w + else + sc=-1 + end + + tree.out(1).dims=list(sr,sc) + tree.out(1).type=Type(String,Real) + tree=Operation("+",tree.operands,tree.out) + end + tree.out(1).contents=Contents() +endfunction + + diff --git a/modules/m2sci/macros/percent/%rc_cell2sci.bin b/modules/m2sci/macros/percent/%rc_cell2sci.bin Binary files differnew file mode 100755 index 000000000..4fded4cf2 --- /dev/null +++ b/modules/m2sci/macros/percent/%rc_cell2sci.bin diff --git a/modules/m2sci/macros/percent/%rc_cell2sci.sci b/modules/m2sci/macros/percent/%rc_cell2sci.sci new file mode 100755 index 000000000..1f3639372 --- /dev/null +++ b/modules/m2sci/macros/percent/%rc_cell2sci.sci @@ -0,0 +1,41 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Scilab +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function tree=%rc_cell2sci(tree) + + // Make a CELL 'row' with many columns + + if typeof(tree.operands(1))=="funcall" then + if tree.operands(1).name=="cell" then + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + return + end + end + + if tree.operands(1).vtype==Cell then + tree.out(1).infer=tree.operands(1).infer + else + tree.out(1).infer=Infer(list(1,1),Type(Cell,Unknown),Contents()) + tree.out(1).contents.index($+1)=list(list(Cste(1),Cste(1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(1).infer + end + dim1=tree.operands(1).dims(1) + dim2=tree.operands(1).dims(2) + tree.out(1).contents.index($+1)=list(list(Cste(dim1),Cste(dim2+1)),Cste("entries")) + tree.out(1).contents.data($+1)=tree.operands(2).infer + + if tree.out(1).dims(2)<>Unknown then + tree.out(1).dims(2)=tree.out(1).dims(2)+1 + end + if tree.out(1).dims(1)==0 then + tree.out(1).dims(1)=tree.out(1).dims(1)+1 + end +endfunction diff --git a/modules/m2sci/macros/percent/%s2sci.bin b/modules/m2sci/macros/percent/%s2sci.bin Binary files differnew file mode 100755 index 000000000..595f0095a --- /dev/null +++ b/modules/m2sci/macros/percent/%s2sci.bin diff --git a/modules/m2sci/macros/percent/%s2sci.sci b/modules/m2sci/macros/percent/%s2sci.sci new file mode 100755 index 000000000..ec3c52bed --- /dev/null +++ b/modules/m2sci/macros/percent/%s2sci.sci @@ -0,0 +1,78 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%s2sci(tree) + // M2SCI function + // Conversion function for Matlab subtraction + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_s() + + // In Matlab only two matrices with the same size can be added unless one is a scalar + // So empty matrix can only be added to a scalar or an onther empty matrix + // For example: [1,2,3]-[] is not possible + // An other important difference with Scilab is that: + // - Matlab gives : [1]-[]=[] + // - Scilab gives : [1]-[]=[1] + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_s_s.sci + // - %s_s_b.sci + + // Binary operator: A-B + if size(tree.operands)==2 then + [A,B]=getoperands(tree) + + // Matlab and Scilab subtraction do not match for Strings + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_s_b is not defined in Scilab + if A.vtype==Boolean & B.vtype==Boolean + A=convert2double(A) + end + + tree.operands=list(A,B) + + // Type inference + if (is_complex(A) & is_real(B)) | (is_complex(B) & is_real(A)) then + tree.out(1).type=Type(Double,Complex) + elseif is_real(A) & is_real(B) then + tree.out(1).type=Type(Double,Real) + else + tree.out(1).type=Type(Double,Unknown) + end + + // When both operands are not [] Scilab and Matlab give the same results + if not_empty(A) & not_empty(B) then + if is_a_scalar(A) then + tree.out(1).dims=B.dims + else + tree.out(1).dims=A.dims + end + // If at least one operand is [] then Matlab result is [] but not Scilab one + elseif is_empty(A) | is_empty(B) then + set_infos(msprintf(gettext("At least one operand of %s is an empty matrix, Scilab equivalent is []."),expression2code(tree)),0) + tree=Cste([]) + else + tree.out(1).dims=allunknown(A.dims); + tree=Funcall("mtlb_s",1,list(A,B),tree.out); + end + else + A=getoperands(tree) + //A=convert2double(A) + tree.operands=list(A) + tree.out(1).dims=A.dims + tree.out(1).type=A.type + end +endfunction diff --git a/modules/m2sci/macros/percent/%t2sci.bin b/modules/m2sci/macros/percent/%t2sci.bin Binary files differnew file mode 100755 index 000000000..00d53892b --- /dev/null +++ b/modules/m2sci/macros/percent/%t2sci.bin diff --git a/modules/m2sci/macros/percent/%t2sci.sci b/modules/m2sci/macros/percent/%t2sci.sci new file mode 100755 index 000000000..af6c53f55 --- /dev/null +++ b/modules/m2sci/macros/percent/%t2sci.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%t2sci(tree) + // M2SCI function + // Conversion function for Matlab transpose + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_t() + + A = getoperands(tree) + + tree.out(1).dims=list(A.dims(2),A.dims(1)) + tree.out(1).type=A.type + + // Scilab and Matlab transposition do not work in the same way for strings + if or(A.vtype==[String,Unknown]) then + tree=Funcall("mtlb_t",1,Rhs_tlist(A),tree.out) + end + +endfunction + diff --git a/modules/m2sci/macros/percent/%x2sci.bin b/modules/m2sci/macros/percent/%x2sci.bin Binary files differnew file mode 100755 index 000000000..8b21ea45b --- /dev/null +++ b/modules/m2sci/macros/percent/%x2sci.bin diff --git a/modules/m2sci/macros/percent/%x2sci.sci b/modules/m2sci/macros/percent/%x2sci.sci new file mode 100755 index 000000000..6ab4cc590 --- /dev/null +++ b/modules/m2sci/macros/percent/%x2sci.sci @@ -0,0 +1,62 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [tree]=%x2sci(tree) + // M2SCI function + // Conversion function for Matlab elementwise multiplication + // Input: tree = Matlab operation tree + // Output: tree = Scilab equivalent for tree + + // Overloading functions in $SCI/modules/compatibility_functions/macros/: + // - %b_x_s.sci + // - %s_x_b.sci + + [A,B]=getoperands(tree) + + // Dot multiplication does not work with Strings in Scilab + if or(A.vtype==[String,Unknown]) then + A=convert2double(A) + end + if or(B.vtype==[String,Unknown]) then + B=convert2double(B) + end + + // %b_x_b is not defined in Scilab$ + if A.vtype==Boolean & B.vtype==Boolean then + A = convert2double(A) + end + + tree.operands=list(A,B) + + if is_complex(A) & is_complex(B) then + prop=Unknown + elseif A.property==Complex | B.property==Complex then + if not_empty(A) & not_empty(B) then + prop=Complex + elseif is_empty(A) | is_empty(B) then + prop=Real + else + prop=Unknown + end + elseif is_real(A) & is_real(B) then + prop=Real + else + prop=Unknown + end + + tree.out(1).type=Type(Double,prop) + + if is_a_scalar(A) then + tree.out(1).dims=B.dims + elseif is_a_scalar(B) then + tree.out(1).dims=A.dims + else + tree.out(1).dims=list(A.dims(1),B.dims(2)) + end +endfunction diff --git a/modules/m2sci/macros/percent/buildmacros.sce b/modules/m2sci/macros/percent/buildmacros.sce new file mode 100755 index 000000000..44591ce9a --- /dev/null +++ b/modules/m2sci/macros/percent/buildmacros.sce @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - Allan CORNET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +//------------------------------------ +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end +//------------------------------------ +genlib("m2scipercentlib","SCI/modules/m2sci/macros/percent",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/percent/get_contents_infer.bin b/modules/m2sci/macros/percent/get_contents_infer.bin Binary files differnew file mode 100755 index 000000000..f6e522e4a --- /dev/null +++ b/modules/m2sci/macros/percent/get_contents_infer.bin diff --git a/modules/m2sci/macros/percent/get_contents_infer.sci b/modules/m2sci/macros/percent/get_contents_infer.sci new file mode 100755 index 000000000..20680b191 --- /dev/null +++ b/modules/m2sci/macros/percent/get_contents_infer.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [infertlist,pos]=get_contents_infer(from,index) + // Search inference data in the contents of a cell or a struct corresponding to a particular index + // Input: + // - from: the cell or struct where we have to search + // - index: index to search + // Output: + // - infertlist: inference data found + // - pos: position where index has been found + + pos=0; + infertlist=Infer(); + + for k=1:lstsize(from.contents.index) + allequal=[] + if lstsize(index)==lstsize(from.contents.index(k)) then // Indexes must have the same size + for ki=1:lstsize(index) + if typeof(index(ki))==typeof(from.contents.index(k)(ki)) then // Index elements must have the same type + if typeof(index(ki))<>"list" then + allequal=allequal & ( and(index(ki)==from.contents.index(k)(ki)) | and(from.contents.index(k)(ki)==Cste("*")) ) + elseif typeof(index(ki))=="list" then + for kii=1:lstsize(index(ki)) + allequal=allequal & ( and(index(ki)(kii)==from.contents.index(k)(ki)(kii)) | and(from.contents.index(k)(ki)(kii)==Cste("*")) ) + end + end + end + end + end + if ~isempty(allequal) & allequal then + pos=k + infertlist=from.contents.data(k) + return + end + end +endfunction diff --git a/modules/m2sci/macros/percent/lib b/modules/m2sci/macros/percent/lib Binary files differnew file mode 100755 index 000000000..c9d0a5a8a --- /dev/null +++ b/modules/m2sci/macros/percent/lib diff --git a/modules/m2sci/macros/percent/names b/modules/m2sci/macros/percent/names new file mode 100755 index 000000000..83d1ef104 --- /dev/null +++ b/modules/m2sci/macros/percent/names @@ -0,0 +1,32 @@ +%02sci +%52sci +%a2sci +%cc2sci +%cc_cell2sci +%d2sci +%e2sci +%e_ce2sci +%e_st2sci +%g2sci +%h2sci +%i2sci +%i2sci_c +%i2sci_g +%i2sci_r +%i2sci_s +%i_ce2sci +%i_st2sci +%imp2sci +%j2sci +%l2sci +%log2sci +%m2sci +%p2sci +%q2sci +%r2sci +%rc2sci +%rc_cell2sci +%s2sci +%t2sci +%x2sci +get_contents_infer |