// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2020 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// For more information, see the COPYING file which you should have received
// along with this program.
-function [tree]=sci_box(tree)
+function tree = sci_box(tree)
// M2SCI function
// Conversion function for Matlab box()
// Input: tree = Matlab funcall tree
// Ouput: tree = Scilab equivalent for tree
// box toggle
- if rhs<=0 then
+ if rhs <= 0 then
tree.name="mtlb_box"
// box on/off
- elseif rhs==1 then
+ elseif rhs == 1 then
if typeof(tree.rhs(1))=="cste" then
- a=gettempvar()
- m2sci_insert(Equal(list(a),Funcall("gca",1,list(),list())))
-
- LHS=Operation("ins",list(a,Cste("box")),list())
- m2sci_insert(Equal(list(LHS),Cste(convstr(tree.rhs(1).value,"l"))))
-
- tree=list()
+ Gca = Funcall("gca",1, list(), list())
+ LHS = Operation("ins", list(Gca,Cste("box")), list())
+ m2sci_insert(Equal(list(LHS), Cste(convstr(tree.rhs(1).value,"l"))))
+ tree = list()
else
- tree.name="mtlb_box"
+ tree.name = "mtlb_box"
end
// box(axes_handle,...)
else
+ ax = tree.rhs(1)
+ if typeof(ax) <> "variable"
+ ax = gettempvar()
+ m2sci_insert(Equal(list(ax), tree.rhs(1)))
+ end
if typeof(tree.rhs(2))=="cste" then
- LHS=Operation("ins",list(tree.rhs(1),Cste("box")),list())
+ LHS = Operation("ins",list(ax,Cste("box")),list())
m2sci_insert(Equal(list(LHS),Cste(convstr(tree.rhs(2).value,"l"))))
-
- tree=list()
+ tree = list()
else
- tree.name="mtlb_box"
+ tree.name = "mtlb_box"
end
end
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2020 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// For more information, see the COPYING file which you should have received
// along with this program.
-function [tree]=sci_cla(tree)
+function tree = sci_cla(tree)
// M2SCI function
// Conversion function for Matlab cla()
// Input: tree = Matlab funcall tree
set_infos(gettext("All children will be deleted, no HandleVisibility property in Scilab graphics."),2);
end
- // a=gca()
- a=gettempvar()
- m2sci_insert(Equal(list(a),Funcall("gca",1,list(),list())))
-
- tree.name="delete"
- tree.rhs=list(Operation("ext",list(a,Cste("children")),list()))
+ tree.name = "delete"
+ Gca = Funcall("gca",1,list(),list())
+ tree.rhs = list(Operation("ext",list(Gca,Cste("children")), list()))
endfunction
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
-//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2020 - Samuel GOUGEON
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// For more information, see the COPYING file which you should have received
// along with this program.
-function [tree]=sci_grid(tree)
+function tree = sci_grid(tree)
// M2SCI function
// Conversion function for Matlab grid()
// Input: tree = Matlab funcall tree
ax=Funcall("gca",1,list(),list())
opt=tree.rhs(1)
if typeof(opt)=="cste" then
+ Gca = Funcall("gca",1, list(), list())
+ LHS = Operation("ins", list(Gca,Cste("grid")), list())
if opt.value=="on" then
- tree.name="set";
- tree.rhs=Rhs_tlist(ax,"grid",on);
+ m2sci_insert(Equal(list(LHS), on))
+ tree = list()
elseif opt.value=="off" then
- tree.name="set";
- tree.rhs=Rhs_tlist(ax,"grid",off);
+ m2sci_insert(Equal(list(LHS), off))
+ tree = list()
else
set_infos(gettext("No minor grid in Scilab."),2);
tree.name="mtlb_grid";
tree.name="mtlb_grid";
end
else
- ax=tree.rhs(1)
- opt=tree.rhs(2)
+ ax = tree.rhs(1)
+ if and(typeof(ax) <> ["variable" "funcall"]) // expression, like [handle1, handle2]
+ ax = gettempvar()
+ m2sci_insert(Equal(list(ax), tree.rhs(1)))
+ end
+ opt = tree.rhs(2)
if typeof(opt)=="cste" then
if opt.value=="on" then
m2sci_insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),on))
- tree=list()
+ tree = list()
elseif opt.value=="off" then
m2sci_insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),off))
- tree=list()
+ tree = list()
else
set_infos(gettext("No minor grid in Scilab."),2);
- tree.name="mtlb_grid";
+ tree.name = "mtlb_grid";
end
else
- tree.name="mtlb_grid";
+ tree.name = "mtlb_grid";
end
end
endfunction
+++ /dev/null
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2009 - INRIA - Serge STEER
-//
-// Copyright (C) 2012 - 2016 - Scilab Enterprises
-//
-// This file is hereby licensed under the terms of the GNU GPL v2.0,
-// pursuant to article 5.3.4 of the CeCILL v.2.1.
-// This file was originally licensed under the terms of the CeCILL v2.1,
-// and continues to be available under such terms.
-// For more information, see the COPYING file which you should have received
-// along with this program.
-function [tree]=sci_subplot(tree)
- // M2SCI function
- // Conversion function for Matlab tic
- // Input: tree = Matlab funcall tree
- // Ouput: tree = Scilab equivalent for tree
-
-endfunction
Macro to tree conversion...
Conversion of M-tree...
L.10: Unknown variable box is a M-file.
- L.13: Unknown variable box is a M-file.
- L.14: Unknown variable box is a M-file.
- L.15: Unknown variable box is a M-file.
- L.16: Unknown variable box is a M-file.
- L.17: Unknown variable box is a M-file.
Conversion of M-tree: Done
TESTING M2SCI: creating varslist file...
Macro to tree conversion: Done
****** End of mfile2sci() session ******
-
// Test file for function box()
// Copyright INRIA
// Matlab version: 6.5.1.199709 (R13) Service Pack 1
// V.C.
-
-%v0 = gca();
-%v0.box = "on";
-%v0 = gca();
-%v0.box = "off";
-%v0 = gca();
-%v0.box = "on";
-%v0 = gca();
-%v0.box = "off";
+gca().box = "on";
+gca().box = "off";
+gca().box = "on";
+gca().box = "off";
mtlb_box
-
-
h.box = "on";
h.box = "off";
h.box = "on";
h.box = "off";
mtlb_box(h)
+%v0 = [h,g];
+%v0.box = "on";
Conversion of M-tree...
L.6: Unknown variable cla is a M-file.
!! L.6: All children will be deleted, no HandleVisibility property in Scilab graphics.
- L.7: Unknown variable cla is a M-file.
Conversion of M-tree: Done
TESTING M2SCI: creating varslist file...
Macro to tree conversion: Done
Translation may be wrong (see the //!! comments).
****** End of mfile2sci() session ******
-
// Test file for function cla
// Copyright INRIA
// Matlab version: 6.5.1.199709 (R13) Service Pack 1
// V.C.
-
-%v0 = gca();
-delete(%v0.children)
-%v0 = gca();
-delete(%v0.children)
+delete(gca().children)
+delete(gca().children)
Conversion of M-tree...
!! L.8: No minor grid in Scilab.
L.9: Unknown variable grid is a M-file.
- L.12: Unknown variable grid is a M-file.
- L.13: Unknown variable grid is a M-file.
- L.14: Unknown variable grid is a M-file.
- !! L.14: No minor grid in Scilab.
- L.15: Unknown variable grid is a M-file.
+ !! L.15: No minor grid in Scilab.
Conversion of M-tree: Done
TESTING M2SCI: creating varslist file...
Macro to tree conversion: Done
Translation may be wrong (see the //!! comments).
****** End of mfile2sci() session ******
-
// Test file for function grid
// Copyright INRIA
// Matlab version: 7.0.0.19901 (R14)
// V.C.
-
-set(gca(),"grid",[1,1])
-set(gca(),"grid",[-1,-1])
+gca().grid = [1,1];
+gca().grid = [-1,-1];
mtlb_grid("minor")
mtlb_grid
-
-
ax.grid = [1,1];
ax.grid = [-1,-1];
mtlb_grid(ax,"minor")
mtlb_grid(ax)
+%v0 = [ax,ax2];
+%v0.grid = [1,1];
box
%m2scideclare h|1 1|handle
+%m2scideclare g|1 1|handle
box(h,'on')
box(h,'off')
box(h,'ON')
box(h,'OFF')
box(h)
-
+box([h g], 'on')
grid
%m2scideclare ax|1 1|Handle
+%m2scideclare ax2|1 1|Handle
grid(ax,'on')
grid(ax,'off')
grid(ax,'minor')
-grid(ax)
\ No newline at end of file
+grid(ax)
+grid([ax ax2], 'on')