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 | |
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')
822 files changed, 27250 insertions, 0 deletions
diff --git a/modules/m2sci/macros/buildmacros.bat b/modules/m2sci/macros/buildmacros.bat new file mode 100755 index 000000000..f464ac666 --- /dev/null +++ b/modules/m2sci/macros/buildmacros.bat @@ -0,0 +1,6 @@ +rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2007 - INRIA - Allan CORNET +rem +rem This file is distributed under the same license as the Scilab package. + +@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
\ No newline at end of file diff --git a/modules/m2sci/macros/buildmacros.sce b/modules/m2sci/macros/buildmacros.sce new file mode 100755 index 000000000..a20ca7fc2 --- /dev/null +++ b/modules/m2sci/macros/buildmacros.sce @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005 - INRIA - Allan CORNET +// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +// +// 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("m2scilib","SCI/modules/m2sci/macros"); +//------------------------------------ +mprintf(gettext("-- Creation of [%s] (Macros) --\n"),"m2sci"); +//------------------------------------ + +lines(0); +CurrentDirectorym2sci = get_absolute_file_path("buildmacros.sce"); +macrosdirs = ["kernel","percent","sci_files"]; + +for i=1:size(macrosdirs,"*") do + exec(CurrentDirectorym2sci+"/"+macrosdirs(i)+"/buildmacros.sce"); +end + +clear my_script_path CurrentDirectorym2sci macrosdirs diff --git a/modules/m2sci/macros/cb_m2sci_gui.bin b/modules/m2sci/macros/cb_m2sci_gui.bin Binary files differnew file mode 100755 index 000000000..66d9b3c30 --- /dev/null +++ b/modules/m2sci/macros/cb_m2sci_gui.bin diff --git a/modules/m2sci/macros/cb_m2sci_gui.sci b/modules/m2sci/macros/cb_m2sci_gui.sci new file mode 100755 index 000000000..d44d6d425 --- /dev/null +++ b/modules/m2sci/macros/cb_m2sci_gui.sci @@ -0,0 +1,182 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - 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 +// + +// Callback function for M2SCI GUI (See m2sci_gui.sci) + +function cb_m2sci_gui + + // + // --- Switch to file conversion mode --- + // + if get(gcbo,"tag")=="fileradio" then + + set(gcbo, "value", 1); + set("dirradio", "value", 0); + + // Make dir objects not-visible + set("dirlabel", "visible","off"); + set("diredit", "visible","off"); + set("dirbtn", "visible","off"); + + // Make file objects visible + set("filedirselect", "border",createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input file"),"left","top",createBorderFont("", 11, "normal"), "black")); + set("filelabel", "visible","on"); + set("fileedit", "visible","on"); + set("filebtn", "visible","on"); + + // + // --- Switch to directory conversion mode --- + // + elseif get(gcbo,"tag")=="dirradio" then + + set(gcbo, "value", 1); + set("fileradio", "value", 0); + + // Make dir objects visible + set("filedirselect", "border",createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input directory"),"left","top",createBorderFont("", 11, "normal"), "black")); + set("dirlabel", "visible", "on"); + set("diredit", "visible", "on"); + set("dirbtn", "visible", "on"); + + // Make file objects not-visible + set("filelabel", "visible", "off"); + set("fileedit", "visible", "off"); + set("filebtn", "visible", "off"); + + // + // --- Directory to convert --- + // + elseif get(gcbo,"tag")=="dirbtn" then + + directoryname = uigetdir(pwd(), gettext("Select the directory to convert")); + set("diredit", "string", directoryname); + + // + // --- File to convert --- + // + elseif get(gcbo,"tag")=="filebtn" then + + filename = uigetfile("*.m", pwd(), gettext("Select the file to convert")); + set("fileedit", "string", filename); + + // + // --- Output directory --- + // + elseif get(gcbo,"tag")=="outbtn" then + + directoryname = uigetdir(pwd(), gettext("Select the directory for generated files")); + set("outedit", "string", directoryname); + + // + // --- Recmode option --- + // + elseif or(get(gcbo, "tag")==["recradioyes","recradiono"]) then + + set("recradioyes", "value", 0); + set("recradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Double option --- + // + elseif or(get(gcbo, "tag")==["doubradioyes","doubradiono"]) then + + set("doubradioyes", "value", 0); + set("doubradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Verbose option --- + // + elseif or(get(gcbo, "tag")==["verbradio0","verbradio1","verbradio2","verbradio3"]) then + + set("verbradio0", "value", 0); + set("verbradio1", "value", 0); + set("verbradio2", "value", 0); + set("verbradio3", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Pretty print option --- + // + elseif or(get(gcbo, "tag")==["ppradioyes","ppradiono"]) then + + set("ppradioyes", "value", 0); + set("ppradiono", "value", 0); + + set(gcbo, "value", 1); + + // + // --- Cancel conversion --- + // + elseif get(gcbo, "tag")=="cancelbtn" | get(gcbo, "tag")=="close_menu" then + //delete(findobj("tag", "m2scifig")); + delete(gcf()) + + // + // --- Launch conversion --- + // + elseif get(gcbo, "tag")=="convertbtn" then + outputdir = get("outedit", "string"); + + rec = get("recradioyes", "value") == 1; + + doub = get("doubradioyes", "value") == 1; + + if get("verbradio0", "value") == 1 then + verb = 0; + elseif get("verbradio1", "value") == 1 then + verb = 1; + elseif get("verbradio2", "value") == 1 then + verb = 2; + else + verb = 3; + end + + pp = get("ppradioyes", "value") == 1; + + if get("fileradio", "value") == 1 then // Single file conversion + inputfile = get("fileedit", "string"); + //delete(findobj("tag", "m2scifig")); + delete(gcf()); + mfile2sci(inputfile, outputdir, rec, doub, verb, pp); + else // Directory conversion + inputdir = get("diredit", "string"); + //delete(findobj("tag", "m2scifig")); + delete(gcf()); + translatepaths(inputdir, outputdir); + end + + // + // --- mfile2sci help --- + // + elseif get(gcbo, "tag")=="mfile2sci_help_menu" then + help mfile2sci + + // + // --- translatepaths help --- + // + elseif get(gcbo, "tag")=="translatepaths_help_menu" then + help translatepaths + + // + // --- About M2SCI --- + // + elseif get(gcbo, "tag")=="about_m2sci_menu" then + help(gettext("About_M2SCI_tools")) + end + +endfunction diff --git a/modules/m2sci/macros/cleanmacros.bat b/modules/m2sci/macros/cleanmacros.bat new file mode 100755 index 000000000..9356615c4 --- /dev/null +++ b/modules/m2sci/macros/cleanmacros.bat @@ -0,0 +1,8 @@ +rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +rem Copyright (C) 2007 - INRIA - Allan CORNET +rem +rem This file is distributed under the same license as the Scilab package. + +@del *.bin 2>NUL +@del lib 2>NUL +@del names 2>NUL
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/%contents_i_funcall.bin b/modules/m2sci/macros/kernel/%contents_i_funcall.bin Binary files differnew file mode 100755 index 000000000..ea3f8cd8c --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_funcall.bin diff --git a/modules/m2sci/macros/kernel/%contents_i_funcall.sci b/modules/m2sci/macros/kernel/%contents_i_funcall.sci new file mode 100755 index 000000000..63f3c1ef4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_funcall.sci @@ -0,0 +1,17 @@ +// 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 funcall=%contents_i_funcall(field,contlist,funcall) + + if field=="contents" then + funcall.lhs(1).infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%contents_i_operatio.bin b/modules/m2sci/macros/kernel/%contents_i_operatio.bin Binary files differnew file mode 100755 index 000000000..6984de3c2 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_operatio.bin diff --git a/modules/m2sci/macros/kernel/%contents_i_operatio.sci b/modules/m2sci/macros/kernel/%contents_i_operatio.sci new file mode 100755 index 000000000..d209095b1 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_operatio.sci @@ -0,0 +1,17 @@ +// 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 operation=%contents_i_operatio(field,contlist,operation) + + if field=="contents" then + operation.out(1).infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%contents_i_variable.bin b/modules/m2sci/macros/kernel/%contents_i_variable.bin Binary files differnew file mode 100755 index 000000000..cdbcc3b38 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_variable.bin diff --git a/modules/m2sci/macros/kernel/%contents_i_variable.sci b/modules/m2sci/macros/kernel/%contents_i_variable.sci new file mode 100755 index 000000000..e10362c97 --- /dev/null +++ b/modules/m2sci/macros/kernel/%contents_i_variable.sci @@ -0,0 +1,17 @@ +// 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 variable=%contents_i_variable(field,contlist,variable) + + if field=="contents" then + variable.infer.contents=contlist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%cste_e.bin b/modules/m2sci/macros/kernel/%cste_e.bin Binary files differnew file mode 100755 index 000000000..64ca00ff9 --- /dev/null +++ b/modules/m2sci/macros/kernel/%cste_e.bin diff --git a/modules/m2sci/macros/kernel/%cste_e.sci b/modules/m2sci/macros/kernel/%cste_e.sci new file mode 100755 index 000000000..3c4dd8182 --- /dev/null +++ b/modules/m2sci/macros/kernel/%cste_e.sci @@ -0,0 +1,27 @@ +// 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 val=%cste_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%funcall_6.bin b/modules/m2sci/macros/kernel/%funcall_6.bin Binary files differnew file mode 100755 index 000000000..65db8eed5 --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_6.bin diff --git a/modules/m2sci/macros/kernel/%funcall_6.sci b/modules/m2sci/macros/kernel/%funcall_6.sci new file mode 100755 index 000000000..274f88ec4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_6.sci @@ -0,0 +1,29 @@ +// 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 val=%funcall_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.lhs(1).infer + elseif field=="dims" then + val=m2scitlist.lhs(1).infer.dims + elseif field=="type" then + val=m2scitlist.lhs(1).infer.type + elseif field=="vtype" then + val=m2scitlist.lhs(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.lhs(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.lhs(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%funcall_e.bin b/modules/m2sci/macros/kernel/%funcall_e.bin Binary files differnew file mode 100755 index 000000000..56f98f63a --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_e.bin diff --git a/modules/m2sci/macros/kernel/%funcall_e.sci b/modules/m2sci/macros/kernel/%funcall_e.sci new file mode 100755 index 000000000..aa227e52f --- /dev/null +++ b/modules/m2sci/macros/kernel/%funcall_e.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 val=%funcall_e(field,m2scitlist) + + val=[] + if field=="infer" then + val=m2scitlist.lhs(1).infer + elseif field=="dims" then + val=m2scitlist.lhs(1).infer.dims + elseif field=="type" then + val=m2scitlist.lhs(1).infer.type + elseif field=="vtype" then + val=m2scitlist.lhs(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.lhs(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.lhs(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%infer_i_s.bin b/modules/m2sci/macros/kernel/%infer_i_s.bin Binary files differnew file mode 100755 index 000000000..ac533086b --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_s.bin diff --git a/modules/m2sci/macros/kernel/%infer_i_s.sci b/modules/m2sci/macros/kernel/%infer_i_s.sci new file mode 100755 index 000000000..528cc0f90 --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_s.sci @@ -0,0 +1,36 @@ +// 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 M=%infer_i_s(varargin) + + [lhs,rhs]=argn(0) + M=varargin(rhs) + N=varargin(rhs-1)//inserted matrix + index=varargin(1) // + + if rhs==3&(type(index)==10|type(index)==15) then + if type(index)<>15 then + M=struct() + M(index)=N + if index=="entries" then + // change struct to cell + f=getfield(1,M);f(1)="ce" + setfield(1,f,M) + end + else + M=createstruct(index,N) + if type(index(1))<>10 & index(2)=="entries" then + // change struct to cell + f=getfield(1,M);f(1)="ce" + setfield(1,f,M) + end + end + return + end +endfunction diff --git a/modules/m2sci/macros/kernel/%infer_i_st.bin b/modules/m2sci/macros/kernel/%infer_i_st.bin Binary files differnew file mode 100755 index 000000000..e452c1545 --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_st.bin diff --git a/modules/m2sci/macros/kernel/%infer_i_st.sci b/modules/m2sci/macros/kernel/%infer_i_st.sci new file mode 100755 index 000000000..a87ce6c00 --- /dev/null +++ b/modules/m2sci/macros/kernel/%infer_i_st.sci @@ -0,0 +1,12 @@ +// 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 st=%infer_i_st(field,infer,st) + st=generic_i_st(field,infer,st) +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_cste.bin b/modules/m2sci/macros/kernel/%l_i_cste.bin Binary files differnew file mode 100755 index 000000000..88c18f3b9 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_cste.bin diff --git a/modules/m2sci/macros/kernel/%l_i_cste.sci b/modules/m2sci/macros/kernel/%l_i_cste.sci new file mode 100755 index 000000000..2f3503f28 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_cste.sci @@ -0,0 +1,19 @@ +// 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 cste=%l_i_cste(field,inslist,cste) + + if field=="dims" then + cste.infer.dims=inslist + elseif field=="type" then + cste.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_funcall.bin b/modules/m2sci/macros/kernel/%l_i_funcall.bin Binary files differnew file mode 100755 index 000000000..bf28cf848 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_funcall.bin diff --git a/modules/m2sci/macros/kernel/%l_i_funcall.sci b/modules/m2sci/macros/kernel/%l_i_funcall.sci new file mode 100755 index 000000000..8d6c66e5f --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_funcall.sci @@ -0,0 +1,18 @@ +// 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 funcall=%l_i_funcall(field,inslist,funcall) + if field=="dims" then + funcall.lhs(1).dims=inslist + elseif field=="type" then + funcall.lhs(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_operatio.bin b/modules/m2sci/macros/kernel/%l_i_operatio.bin Binary files differnew file mode 100755 index 000000000..655a4a679 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_operatio.bin diff --git a/modules/m2sci/macros/kernel/%l_i_operatio.sci b/modules/m2sci/macros/kernel/%l_i_operatio.sci new file mode 100755 index 000000000..ad4fe2162 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_operatio.sci @@ -0,0 +1,18 @@ +// 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 operation=%l_i_operatio(field,inslist,operation) + if field=="dims" then + operation.out(1).dims=inslist + elseif field=="type" then + operation.out(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%l_i_variable.bin b/modules/m2sci/macros/kernel/%l_i_variable.bin Binary files differnew file mode 100755 index 000000000..892071fe0 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_variable.bin diff --git a/modules/m2sci/macros/kernel/%l_i_variable.sci b/modules/m2sci/macros/kernel/%l_i_variable.sci new file mode 100755 index 000000000..68c109e99 --- /dev/null +++ b/modules/m2sci/macros/kernel/%l_i_variable.sci @@ -0,0 +1,20 @@ +// 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 var=%l_i_variable(field,inslist,var) + if field=="dims" then + var.infer.dims=inslist + elseif field=="type" then + var.infer.type=inslist + elseif field=="contents" then + var.infer.contents=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%m2scivar_e.bin b/modules/m2sci/macros/kernel/%m2scivar_e.bin Binary files differnew file mode 100755 index 000000000..af7c773c4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%m2scivar_e.bin diff --git a/modules/m2sci/macros/kernel/%m2scivar_e.sci b/modules/m2sci/macros/kernel/%m2scivar_e.sci new file mode 100755 index 000000000..47da81db4 --- /dev/null +++ b/modules/m2sci/macros/kernel/%m2scivar_e.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 val=%m2scivar_e(field,m2scitlist) + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%operatio_6.bin b/modules/m2sci/macros/kernel/%operatio_6.bin Binary files differnew file mode 100755 index 000000000..241c7e464 --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_6.bin diff --git a/modules/m2sci/macros/kernel/%operatio_6.sci b/modules/m2sci/macros/kernel/%operatio_6.sci new file mode 100755 index 000000000..d5cc4661e --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_6.sci @@ -0,0 +1,29 @@ +// 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 val=%operatio_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.out(1).infer + elseif field=="dims" then + val=m2scitlist.out(1).infer.dims + elseif field=="type" then + val=m2scitlist.out(1).infer.type + elseif field=="vtype" then + val=m2scitlist.out(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.out(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.out(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%operatio_e.bin b/modules/m2sci/macros/kernel/%operatio_e.bin Binary files differnew file mode 100755 index 000000000..08fdf78db --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_e.bin diff --git a/modules/m2sci/macros/kernel/%operatio_e.sci b/modules/m2sci/macros/kernel/%operatio_e.sci new file mode 100755 index 000000000..66907542c --- /dev/null +++ b/modules/m2sci/macros/kernel/%operatio_e.sci @@ -0,0 +1,29 @@ +// 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 val=%operatio_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.out(1).infer + elseif field=="dims" then + val=m2scitlist.out(1).infer.dims + elseif field=="type" then + val=m2scitlist.out(1).infer.type + elseif field=="vtype" then + val=m2scitlist.out(1).infer.type.vtype + elseif field=="property" then + val=m2scitlist.out(1).infer.type.property + elseif field=="contents" then + val=m2scitlist.out(1).infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%s_i_operatio.bin b/modules/m2sci/macros/kernel/%s_i_operatio.bin Binary files differnew file mode 100755 index 000000000..357dc8c5e --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_operatio.bin diff --git a/modules/m2sci/macros/kernel/%s_i_operatio.sci b/modules/m2sci/macros/kernel/%s_i_operatio.sci new file mode 100755 index 000000000..4ac65ba1b --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_operatio.sci @@ -0,0 +1,18 @@ +// 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 op=%s_i_operatio(field,cste,op) + if field=="vtype" then + op.type.vtype=cste + elseif field=="property" then + op.type.property=cste + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%s_i_variable.bin b/modules/m2sci/macros/kernel/%s_i_variable.bin Binary files differnew file mode 100755 index 000000000..19778f4f7 --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_variable.bin diff --git a/modules/m2sci/macros/kernel/%s_i_variable.sci b/modules/m2sci/macros/kernel/%s_i_variable.sci new file mode 100755 index 000000000..1998542a6 --- /dev/null +++ b/modules/m2sci/macros/kernel/%s_i_variable.sci @@ -0,0 +1,21 @@ +// 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 var=%s_i_variable(field,cste,var) + + if field=="vtype" then + var.infer.type.vtype=cste + elseif field=="property" then + var.infer.type.property=cste + elseif field=="contents" then + var.infer.contents=cste + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_cste.bin b/modules/m2sci/macros/kernel/%type_i_cste.bin Binary files differnew file mode 100755 index 000000000..1f082b41f --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_cste.bin diff --git a/modules/m2sci/macros/kernel/%type_i_cste.sci b/modules/m2sci/macros/kernel/%type_i_cste.sci new file mode 100755 index 000000000..a85e4c240 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_cste.sci @@ -0,0 +1,17 @@ +// 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 cste=%type_i_cste(field,inslist,cste) + + if field=="type" then + cste.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_funcall.bin b/modules/m2sci/macros/kernel/%type_i_funcall.bin Binary files differnew file mode 100755 index 000000000..fe57ef823 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_funcall.bin diff --git a/modules/m2sci/macros/kernel/%type_i_funcall.sci b/modules/m2sci/macros/kernel/%type_i_funcall.sci new file mode 100755 index 000000000..996a354bd --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_funcall.sci @@ -0,0 +1,17 @@ +// 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 funcall=%type_i_funcall(field,inslist,funcall) + + if field=="type" then + funcall.lhs(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_operatio.bin b/modules/m2sci/macros/kernel/%type_i_operatio.bin Binary files differnew file mode 100755 index 000000000..a70ae1a1b --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_operatio.bin diff --git a/modules/m2sci/macros/kernel/%type_i_operatio.sci b/modules/m2sci/macros/kernel/%type_i_operatio.sci new file mode 100755 index 000000000..137be6fc9 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_operatio.sci @@ -0,0 +1,17 @@ +// 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 operation=%type_i_operatio(field,inslist,operation) + + if field=="type" then + operation.out(1).type=inslist + else + error(gettext("Not yet implemented.")) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%type_i_variable.bin b/modules/m2sci/macros/kernel/%type_i_variable.bin Binary files differnew file mode 100755 index 000000000..e781b7364 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_variable.bin diff --git a/modules/m2sci/macros/kernel/%type_i_variable.sci b/modules/m2sci/macros/kernel/%type_i_variable.sci new file mode 100755 index 000000000..d0ab15387 --- /dev/null +++ b/modules/m2sci/macros/kernel/%type_i_variable.sci @@ -0,0 +1,40 @@ +// 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 var=%type_i_variable(field,inslist,var) + + if typeof(inslist)=="ce" then + if field=="type" then + var.infer=inslist + else + error(gettext("Not yet implemented.")) + end + elseif typeof(inslist)=="st" then + pause + else + if or(typeof(var.infer)==["ce","st"]) then + if field=="type" then + dims=list() + for kd=1:size(var.infer.dims,"*") + dims(kd)=var.infer.dims(kd) + end + var.infer=Infer(dims,Type()) + var.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end + else + if field=="type" then + var.infer.type=inslist + else + error(gettext("Not yet implemented.")) + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/%variable_6.bin b/modules/m2sci/macros/kernel/%variable_6.bin Binary files differnew file mode 100755 index 000000000..512ab3a8d --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_6.bin diff --git a/modules/m2sci/macros/kernel/%variable_6.sci b/modules/m2sci/macros/kernel/%variable_6.sci new file mode 100755 index 000000000..6a735f665 --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_6.sci @@ -0,0 +1,29 @@ +// 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 val=%variable_6(field,m2scitlist) + // File generated from %PROTO_6.g: PLEASE DO NOT EDIT ! + + val=[] + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/%variable_e.bin b/modules/m2sci/macros/kernel/%variable_e.bin Binary files differnew file mode 100755 index 000000000..6fe7b191a --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_e.bin diff --git a/modules/m2sci/macros/kernel/%variable_e.sci b/modules/m2sci/macros/kernel/%variable_e.sci new file mode 100755 index 000000000..6a7fab8e8 --- /dev/null +++ b/modules/m2sci/macros/kernel/%variable_e.sci @@ -0,0 +1,30 @@ +// 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 val=%variable_e(field,m2scitlist) + // File generated from %PROTO_e.g: PLEASE DO NOT EDIT ! + + val=[] + + if field=="infer" then + val=m2scitlist.infer + elseif field=="dims" then + val=m2scitlist.infer.dims + elseif field=="type" then + val=m2scitlist.infer.type + elseif field=="vtype" then + val=m2scitlist.infer.type.vtype + elseif field=="property" then + val=m2scitlist.infer.type.property + elseif field=="contents" then + val=m2scitlist.infer.contents + else + error(msprintf(gettext("Extraction of %s from ''%s'' tlist is not yet implemented."),string(field),typeof(m2scitlist))) + end +endfunction diff --git a/modules/m2sci/macros/kernel/Contents.bin b/modules/m2sci/macros/kernel/Contents.bin Binary files differnew file mode 100755 index 000000000..b87f044a2 --- /dev/null +++ b/modules/m2sci/macros/kernel/Contents.bin diff --git a/modules/m2sci/macros/kernel/Contents.sci b/modules/m2sci/macros/kernel/Contents.sci new file mode 100755 index 000000000..f4f91811a --- /dev/null +++ b/modules/m2sci/macros/kernel/Contents.sci @@ -0,0 +1,31 @@ +// 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 cont=Contents(varargin) + // Create a new inference tlist + + fields=["contents","index","data"] + + nargs=size(varargin) + + // Contents: all unknown + if nargs==0 then + cont=tlist(fields,list(),list()) + elseif nargs==2 then + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("index must be a list instead of a: %s."),typeof(varargin(1)))) + end + if typeof(varargin(2))<>"list" then + error(msprintf(gettext("index must be a list instead of a: %s."),typeof(varargin(2)))) + end + cont=tlist(fields,varargin(1),varargin(2)) + else + error(gettext("Wrong number of inputs.")); + end +endfunction diff --git a/modules/m2sci/macros/kernel/Cste.bin b/modules/m2sci/macros/kernel/Cste.bin Binary files differnew file mode 100755 index 000000000..7936c7337 --- /dev/null +++ b/modules/m2sci/macros/kernel/Cste.bin diff --git a/modules/m2sci/macros/kernel/Cste.sci b/modules/m2sci/macros/kernel/Cste.sci new file mode 100755 index 000000000..8dd54986a --- /dev/null +++ b/modules/m2sci/macros/kernel/Cste.sci @@ -0,0 +1,51 @@ +// 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 const=Cste(value) + // Create a new constant tlist + + rhs=argn(2) + + if rhs~=1 then + error(gettext("Wrong number of inputs.")); + end + + dims=list() + + if value=="" then + dims=list(0,0) + else + sz=size(value) + for k=1:size(sz,"*") + dims($+1)=sz(k) + if type(value)==String then + if k==2 then + dims($)=sum(length(value)) + end + end + end + end + + if type(value)==String then + prop=Real + value=value + else + if type(value)==1 then + if isreal(value) then + prop=Real + else + prop=Complex + end + else + prop=Real + end + end + + const=tlist(["cste","value","infer"],value,Infer(dims,Type(type(value),prop))) +endfunction diff --git a/modules/m2sci/macros/kernel/Equal.bin b/modules/m2sci/macros/kernel/Equal.bin Binary files differnew file mode 100755 index 000000000..504a4c80d --- /dev/null +++ b/modules/m2sci/macros/kernel/Equal.bin diff --git a/modules/m2sci/macros/kernel/Equal.sci b/modules/m2sci/macros/kernel/Equal.sci new file mode 100755 index 000000000..d742b690a --- /dev/null +++ b/modules/m2sci/macros/kernel/Equal.sci @@ -0,0 +1,34 @@ +// 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 eq=Equal(lhslist,expression,endsymbol) + // Create a new 'equal' tlist + + rhs=argn(2) + + if rhs<2 then + error(gettext("Wrong number of inputs.")) + end + if rhs<3 then + endsymbol=";" + end + if typeof(lhslist)<>"list" then + error(msprintf(gettext("lhslist should be a list and not a: %s."),typeof(lhslist))); + end + if and(typeof(expression)<>["funcall","cste","operation","variable"]) then + disp(expression) + error(msprintf(gettext("expression can not be a: %s."),typeof(expression))) + end + if type(endsymbol)<>10 then + error(msprintf(gettext("endsymbol should be a character string and not a: %s."),typeof(lhslist))); + end + + eq=tlist(["equal","lhs","expression","endsymbol"],lhslist,expression,endsymbol) + +endfunction diff --git a/modules/m2sci/macros/kernel/Funcall.bin b/modules/m2sci/macros/kernel/Funcall.bin Binary files differnew file mode 100755 index 000000000..9d1fa324f --- /dev/null +++ b/modules/m2sci/macros/kernel/Funcall.bin diff --git a/modules/m2sci/macros/kernel/Funcall.sci b/modules/m2sci/macros/kernel/Funcall.sci new file mode 100755 index 000000000..feca5cf5a --- /dev/null +++ b/modules/m2sci/macros/kernel/Funcall.sci @@ -0,0 +1,30 @@ +// 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 funcall_tlist=Funcall(name,lhsnb,rhslist,lhslist) + // Copyright INRIA + // Create a new function tlist + + rhs=argn(2) + + // Verify input value + if rhs~=4 then + error(gettext("Wrong number of inputs.")); + elseif typeof(name)~="string" then + error(msprintf(gettext("name must be a string instead of a: %s."),typeof(name))); + elseif typeof(lhsnb)~="constant" then + error(msprintf(gettext("lhsnb must be a constant instead of a: %s."),typeof(lhsnb))); + elseif typeof(rhslist)~="list" & rhslist<>[] then + error(msprintf(gettext("rhslist must be a list instead of a: %s."),typeof(rhslist))); + elseif typeof(lhslist)~="list" then + error(msprintf(gettext("lhslist must be a list instead of a: %s."),typeof(lhslist))); + end + + funcall_tlist=tlist(["funcall","name","lhsnb","rhs","lhs"],name,lhsnb,rhslist,lhslist) +endfunction diff --git a/modules/m2sci/macros/kernel/Infer.bin b/modules/m2sci/macros/kernel/Infer.bin Binary files differnew file mode 100755 index 000000000..661284cb1 --- /dev/null +++ b/modules/m2sci/macros/kernel/Infer.bin diff --git a/modules/m2sci/macros/kernel/Infer.sci b/modules/m2sci/macros/kernel/Infer.sci new file mode 100755 index 000000000..26e3100cc --- /dev/null +++ b/modules/m2sci/macros/kernel/Infer.sci @@ -0,0 +1,42 @@ +// 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 infer=Infer(varargin) + // Create a new inference tlist + + fields=["infer","dims","type","contents"] + + rhs=argn(2) + + nargs=size(varargin) + + // Infer(): all unknown + if nargs==0 then + infer=tlist(fields,list(Unknown,Unknown),Type(Unknown,Unknown),Contents()) + elseif nargs==2 then + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("dims must be a list instead of a: %s."),typeof(varargin(1)))); + end + if typeof(varargin(2))<>"type" then + error(msprintf(gettext("type must be a ''type'' tlist instead of a: %s."),typeof(varargin(2)))); + end + infer=tlist(fields,varargin(1),varargin(2),Contents()) + elseif nargs==3 then // Should only be used for cells and structs + if typeof(varargin(1))<>"list" then + error(msprintf(gettext("dims must be a list instead of a: %s."),typeof(varargin(1)))); + end + if typeof(varargin(2))<>"type" then + error(msprintf(gettext("type must be a ''type'' tlist instead of a: %s."),typeof(varargin(2)))); + end + if typeof(varargin(3))<>"contents" then + error(msprintf(gettext("contents must be a ''contents'' tlist instead of a: %s."),typeof(varargin(3)))); + end + infer=tlist(fields,varargin(1),varargin(2),varargin(3)) + end +endfunction diff --git a/modules/m2sci/macros/kernel/M2scivar.bin b/modules/m2sci/macros/kernel/M2scivar.bin Binary files differnew file mode 100755 index 000000000..6521eeddd --- /dev/null +++ b/modules/m2sci/macros/kernel/M2scivar.bin diff --git a/modules/m2sci/macros/kernel/M2scivar.sci b/modules/m2sci/macros/kernel/M2scivar.sci new file mode 100755 index 000000000..c755548c3 --- /dev/null +++ b/modules/m2sci/macros/kernel/M2scivar.sci @@ -0,0 +1,32 @@ +// 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 var=M2scivar(sciname,matname,infer,call_level) + // Create a new 'm2scivar' tlist + + rhs=argn(2) + + if rhs<3 then + error(gettext("Wrong number of inputs.")) + end + if rhs==3 then + call_level=0 + end + + if typeof(sciname)~="string" then + error(msprintf(gettext("sciname must be a string instead of a: %s."),typeof(sciname))); + elseif typeof(matname)~="string" then + error(msprintf(gettext("matname must be a string instead of a: %s."),typeof(matname))); + elseif typeof(infer)~="infer" then + error(msprintf(gettext("infer must be an ''infer'' tlist instead of a: %s."),typeof(infer))); + end + + var=tlist(["m2scivar","sciname","matname","infer","level"],sciname,matname,infer,call_level) + +endfunction diff --git a/modules/m2sci/macros/kernel/Operation.bin b/modules/m2sci/macros/kernel/Operation.bin Binary files differnew file mode 100755 index 000000000..eec4f0bb0 --- /dev/null +++ b/modules/m2sci/macros/kernel/Operation.bin diff --git a/modules/m2sci/macros/kernel/Operation.sci b/modules/m2sci/macros/kernel/Operation.sci new file mode 100755 index 000000000..0c2ed5eac --- /dev/null +++ b/modules/m2sci/macros/kernel/Operation.sci @@ -0,0 +1,29 @@ +// 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 operation_tlist=Operation(operator,operands,out) + // Create a new operation tlist + + rhs=argn(2) + + // Verify input value + if rhs~=3 then + error(gettext("Wrong number of inputs.")) + end + + if typeof(operator)~="string" then + error(msprintf(gettext("operator must be a string instead of a: %s."),typeof(operator)));; + elseif typeof(operands)~="list" then + error(msprintf(gettext("operands must be a list instead of a: %s."),typeof(operands))); + elseif typeof(out)~="list" then + error(msprintf(gettext("out must be a list instead of a: %s."),typeof(out))); + end + + operation_tlist=tlist(["operation","operator","operands","out"],operator,operands,out) +endfunction diff --git a/modules/m2sci/macros/kernel/Rhs_tlist.bin b/modules/m2sci/macros/kernel/Rhs_tlist.bin Binary files differnew file mode 100755 index 000000000..6df3132ed --- /dev/null +++ b/modules/m2sci/macros/kernel/Rhs_tlist.bin diff --git a/modules/m2sci/macros/kernel/Rhs_tlist.sci b/modules/m2sci/macros/kernel/Rhs_tlist.sci new file mode 100755 index 000000000..437971d81 --- /dev/null +++ b/modules/m2sci/macros/kernel/Rhs_tlist.sci @@ -0,0 +1,31 @@ +// 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 rhs_tlist=Rhs_tlist(varargin) + // Create a new rhs tlist + + expressions=list() + if size(varargin)==1 then + if or(typeof(varargin(1))==["string","constant"]) then + expressions(1)=Cste(varargin(1)) + else + expressions(1)=varargin(1) + end + else + for k=1:size(varargin) + if or(typeof(varargin(k))==["string","constant"]) then + expressions(k)=Cste(varargin(k)) + elseif varargin(k)<>list() then //list() is used for rand()... + expressions(k)=varargin(k) + end + end + end + rhs_tlist=expressions + +endfunction diff --git a/modules/m2sci/macros/kernel/Type.bin b/modules/m2sci/macros/kernel/Type.bin Binary files differnew file mode 100755 index 000000000..35edeaf53 --- /dev/null +++ b/modules/m2sci/macros/kernel/Type.bin diff --git a/modules/m2sci/macros/kernel/Type.sci b/modules/m2sci/macros/kernel/Type.sci new file mode 100755 index 000000000..ec587b11a --- /dev/null +++ b/modules/m2sci/macros/kernel/Type.sci @@ -0,0 +1,30 @@ +// 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 Type_tlist=Type(vtype,property) + // Create a new 'type' tlist for inference + + rhs=argn(2) + if rhs<2 then + Type_tlist=tlist(["type","vtype","property"],Unknown,Unknown) + return + end + + if and(vtype~=[Double,Boolean,String,Unknown,Sparse,Cell,Struct,Int,Handle]) then + error(msprintf(gettext("%s is not yet implemented."),string(vtype))) + end + + if typeof(property)=="list" then + error(gettext("list of properties is not yet implemented.")) + elseif and(property~=[Real,Complex,Unknown]) then + error(msprintf(gettext("wrong property %s."),string(property))) + end + + Type_tlist=tlist(["type","vtype","property"],vtype,property) +endfunction diff --git a/modules/m2sci/macros/kernel/Variable.bin b/modules/m2sci/macros/kernel/Variable.bin Binary files differnew file mode 100755 index 000000000..7132c5a53 --- /dev/null +++ b/modules/m2sci/macros/kernel/Variable.bin diff --git a/modules/m2sci/macros/kernel/Variable.sci b/modules/m2sci/macros/kernel/Variable.sci new file mode 100755 index 000000000..7b55ff9e1 --- /dev/null +++ b/modules/m2sci/macros/kernel/Variable.sci @@ -0,0 +1,27 @@ +// 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 var=Variable(name,infer) + // Create a new variable tlist + + rhs=argn(2) + + if rhs<>2 then + error(gettext("Wrong number of inputs.")) + end + + if typeof(name)~="string" then + error(msprintf(gettext("name must be a string instead of a: %s."),typeof(name))) + elseif typeof(infer)~="infer" then + error(msprintf(gettext("infer must be an ''infer'' tlist instead of a: %s."),typeof(infer))) + end + + var=tlist(["variable","name","infer"],name,infer) + +endfunction diff --git a/modules/m2sci/macros/kernel/allunknown.bin b/modules/m2sci/macros/kernel/allunknown.bin Binary files differnew file mode 100755 index 000000000..f58cc3854 --- /dev/null +++ b/modules/m2sci/macros/kernel/allunknown.bin diff --git a/modules/m2sci/macros/kernel/allunknown.sci b/modules/m2sci/macros/kernel/allunknown.sci new file mode 100755 index 000000000..8e469a182 --- /dev/null +++ b/modules/m2sci/macros/kernel/allunknown.sci @@ -0,0 +1,17 @@ +// 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 dims=allunknown(in) + + dims=list() + for k=1:size(in) + dims(k)=-1 + end + +endfunction diff --git a/modules/m2sci/macros/kernel/buildmacros.sce b/modules/m2sci/macros/kernel/buildmacros.sce new file mode 100755 index 000000000..1adb52e12 --- /dev/null +++ b/modules/m2sci/macros/kernel/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("m2scikernellib","SCI/modules/m2sci/macros/kernel",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/kernel/changevarname.bin b/modules/m2sci/macros/kernel/changevarname.bin Binary files differnew file mode 100755 index 000000000..44c51a08a --- /dev/null +++ b/modules/m2sci/macros/kernel/changevarname.bin diff --git a/modules/m2sci/macros/kernel/changevarname.sci b/modules/m2sci/macros/kernel/changevarname.sci new file mode 100755 index 000000000..00e3837ff --- /dev/null +++ b/modules/m2sci/macros/kernel/changevarname.sci @@ -0,0 +1,63 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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 changevarname(fun,oldname,newname) + // This function replaces the variable (named oldname) of a file by a new name (which is newname). It uses the old2newinstr function + // INPUTS: + // -fun: a string, the name (with the whole path) of the modifed file + // -oldname: a string, the old name of the variable + // -newname: a string, the new name of the variable after modification + + sep=filesep(); + + sep_ind=strindex(fun,sep); + dot_ind=strindex(fun,"."); + + // funname is the function name (without the path and the extension) + funname=part(fun,sep_ind($)+1:dot_ind($)-1); + + if sep_ind<>[] + funsave=part(fun,1:sep_ind($))+"save_"+part(fun,sep_ind($)+1:dot_ind($)-1)+".sci"; + else + funsave="save_"+part(fun,sep_ind($)+1:dot_ind($)-1)+".sci"; + end + + // Compilation + exec(fun); + var=who("get"); + indvar=find(var==funname); + funvect=var(indvar(1):-1:1); + txt=mgetl(fun); + mputl(txt,funsave); + + txt=[] + for j=1:size(funvect,1) + //Get the tree of the function + execstr("tree=macr2tree("+funvect(j)+")"); + // Change oldname into newname in the tree + if tree.name==oldname then + tree.name=newname; + end + for i=1:size(tree.inputs) + tree.inputs(i)=old2newinstr(tree.inputs(i),oldname,newname); + end + for i=1:size(tree.outputs) + tree.outputs(i)=old2newinstr(tree.outputs(i),oldname,newname); + end + for i=1:size(tree.statements) + tree.statements(i)=old2newinstr(tree.statements(i),oldname,newname); + end + + // Get the matching code of the tree after modification + txt=[txt; tree2code(tree,%T)]; + end + + // Replace the old code by the new code (which is txt) in the file fun + mputl(txt,fun); +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/clause2sci.bin b/modules/m2sci/macros/kernel/clause2sci.bin Binary files differnew file mode 100755 index 000000000..2690bd04d --- /dev/null +++ b/modules/m2sci/macros/kernel/clause2sci.bin diff --git a/modules/m2sci/macros/kernel/clause2sci.sci b/modules/m2sci/macros/kernel/clause2sci.sci new file mode 100755 index 000000000..a50a74bef --- /dev/null +++ b/modules/m2sci/macros/kernel/clause2sci.sci @@ -0,0 +1,385 @@ +// 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 [sci_clause,nblines]=clause2sci(mtlb_clause,nblines,leveltemp) + // M2SCI function + + // Global variables for M2SCI + global("m2sci_to_insert_b") + global("varslist") + + // Increment level of clause indentation + level + + // Temp variable used to store instructions to insert before clause + to_insert=list() + select typeof(mtlb_clause) + // --- TRYCATCH --- + case "trycatch" + level=[level;0] + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert try + sci_try=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.trystat) + if typeof(mtlb_clause.trystat(k))=="sup_equal" then + sci_try_temp=list() + for i=1:size(mtlb_clause.trystat(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.trystat(k).sup_instr(i),nblines) + sci_try_temp=update_instr_list(sci_try_temp,instr) + end + sci_try($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_try_temp,mtlb_clause.trystat(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.trystat(k),nblines) + sci_try=update_instr_list(sci_try,instr) + end + end + + // Convert catch + sci_catch=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.catchstat) + if typeof(mtlb_clause.catchstat(k))=="sup_equal" then + sci_catch_temp=list() + for i=1:size(mtlb_clause.catchstat(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.catchstat(k).sup_instr(i),nblines) + sci_catch_temp=update_instr_list(sci_catch_temp,instr) + end + sci_catch($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_catch_temp,mtlb_clause.catchstat(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.catchstat(k),nblines) + sci_catch=update_instr_list(sci_catch,instr) + end + end + + // Create Scilab trycatch + sci_clause=tlist(["trycatch","trystat","catchstat"],sci_try,sci_catch) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- IF --- + case "ifthenelse" + level=[level;0] + + // Convert expression + [sci_expr]=expression2sci(mtlb_clause.expression) + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert then statements + sci_then=list() + level($)=level($)+1 + for k=1:size(mtlb_clause.then) + if typeof(mtlb_clause.then(k))=="sup_equal" then + sci_then_temp=list() + for i=1:size(mtlb_clause.then(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.then(k).sup_instr(i),nblines) + sci_then_temp=update_instr_list(sci_then_temp,instr) + end + sci_then($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_then_temp,mtlb_clause.then(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.then(k),nblines) + sci_then=update_instr_list(sci_then,instr) + end + end + + // Convert elseifs + sci_elseifs=list() + for k=1:size(mtlb_clause.elseifs) + level($)=level($)+1 + + // Convert expression + [sci_exprn]=expression2sci(mtlb_clause.elseifs(k).expression) + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert statements + sci_stat=list() + for l=1:size(mtlb_clause.elseifs(k).then) + if typeof(mtlb_clause.elseifs(k).then(l))=="sup_equal" then + sci_stat_temp=list() + for i=1:size(mtlb_clause.elseifs(k).then(l).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.elseifs(k).then(l).sup_instr(i),nblines) + sci_stat_temp=update_instr_list(sci_stat_temp,instr) + end + sci_stat($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat_temp,mtlb_clause.elseifs(k).then(l).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.elseifs(k).then(l),nblines) + sci_stat=update_instr_list(sci_stat,instr) + end + end + sci_elseifs($+1)=tlist(["elseif","expression","then"],sci_exprn,sci_stat) + end + + // Convert else + sci_else=list() + if size(mtlb_clause.else)<>0 then + level($)=level($)+1 + end + for k=1:size(mtlb_clause.else) + if typeof(mtlb_clause.else(k))=="sup_equal" then + sci_else_temp=list() + for i=1:size(mtlb_clause.else(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.else(k).sup_instr(i),nblines) + sci_else_temp=update_instr_list(sci_else_temp,instr) + end + sci_else($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_else_temp,mtlb_clause.else(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.else(k),nblines) + sci_else=update_instr_list(sci_else,instr) + end + end + + // Create Scilab ifthenelse + sci_clause=tlist(["ifthenelse","expression","then","elseifs","else"],sci_expr,sci_then,sci_elseifs,sci_else) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- SELECT --- + case "selectcase" + level=[level;0] + // Convert expression + sci_expr=list() + [sci_expr(1)]=expression2sci(mtlb_clause.expression(1)) + for i=2:size(mtlb_clause.expression) + sci_expr(i)=mtlb_clause.expression(i) // EOL or comment + end + + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert cases + sci_cases=list() + k=0 + while k<size(mtlb_clause.cases) + k=k+1 + level($)=level($)+1 + // Convert expression + if typeof(mtlb_clause.cases(k).expression)=="funcall" then + if mtlb_clause.cases(k).expression.name=="makecell" then + // Insert new cases + for nbcas=size(mtlb_clause.cases):-1:k+1 + mtlb_clause.cases(nbcas+size(mtlb_clause.cases(k).expression.rhs))=mtlb_clause.cases(nbcas) + end + for nbrhs=1:size(mtlb_clause.cases(k).expression.rhs) + mtlb_clause.cases(nbrhs+k)=tlist(["case","expression","then"],mtlb_clause.cases(k).expression.rhs(nbrhs),mtlb_clause.cases(k).then) + end + mtlb_clause.cases(k)=null() + end + end + [sci_exprn]=expression2sci(mtlb_clause.cases(k).expression) + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert statements + sci_stat=list() + for l=1:size(mtlb_clause.cases(k).then) + if typeof(mtlb_clause.cases(k).then(l))=="sup_equal" then + sci_stat_temp=list() + for i=1:size(mtlb_clause.cases(k).then(l).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.cases(k).then(l).sup_instr(i),nblines) + sci_stat_temp=update_instr_list(sci_stat_temp,instr) + end + sci_stat($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat_temp,mtlb_clause.cases(k).then(l).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.cases(k).then(l),nblines) + sci_stat=update_instr_list(sci_stat,instr) + end + end + sci_cases($+1)=tlist(["case","expression","then"],sci_exprn,sci_stat) + end + + // Convert else + sci_else=list() + if size(mtlb_clause.else)<>0 then + level($)=level($)+1 + end + for k=1:size(mtlb_clause.else) + if typeof(mtlb_clause.else(k))=="sup_equal" then + sci_else_temp=list(); + for i=1:size(mtlb_clause.else(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.else(k).sup_instr(i),nblines) + sci_else_temp=update_instr_list(sci_else_temp,instr) + end + sci_else($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_else_temp,mtlb_clause.else(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.else(k),nblines) + sci_else=update_instr_list(sci_else,instr) + end + end + // Create Scilab selectcase + sci_clause=tlist(["selectcase","expression","cases","else"],sci_expr,sci_cases,sci_else) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- WHILE --- + case "while" + level=[level;0] + sci_do=list() + // Convert expression + [sci_expr]=expression2sci(mtlb_clause.expression) + // If there are instructions to insert, while is modified so that inserted instruction is evaluated in each loop + if m2sci_to_insert_b<>list() then + newif=tlist(["ifthenelse","expression","then","elseifs","else"],sci_expr,list(Funcall("break",1,list(),list())),list(),list()) + m2sci_to_insert_b($+1)=newif + sci_expr=Cste(%T) + sci_do=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + + // Convert all do instructions + level($)=level($)+1 + for k=1:size(mtlb_clause.statements) + if typeof(mtlb_clause.statements(k))=="sup_equal" then + sci_do_temp=list() + for i=1:size(mtlb_clause.statements(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.statements(k).sup_instr(i),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_do_temp=update_instr_list(sci_do_temp,instr) + end + sci_do($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_do_temp,mtlb_clause.statements(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.statements(k),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_do=update_instr_list(sci_do,instr) + end + end + + // Create Scilab while + sci_clause=tlist(["while","expression","statements"],sci_expr,sci_do) + level($)=level($)+1 + updatevarslist("END OF CLAUSE") + + // --- FOR --- + case "for" + //level=[level;1] + // Convert expression + [sci_expr,nblines]=instruction2sci(mtlb_clause.expression,nblines) + if typeof(sci_expr)=="equal" then + [bval,pos]=isdefinedvar(sci_expr.lhs(1)) + if bval then + varslist(pos).infer.dims=list(varslist(pos).infer.dims(1),1) + end + end + // Get instructions to insert if there are + if m2sci_to_insert_b<>list() then + to_insert=m2sci_to_insert_b + m2sci_to_insert_b=list() + end + sci_instr=list() + // Convert all do instructions + for k=1:size(mtlb_clause.statements) + if typeof(mtlb_clause.statements(k))=="sup_equal" then + sci_instr_temp=list() + for i=1:size(mtlb_clause.statements(k).sup_instr) + [instr,nblines]=instruction2sci(mtlb_clause.statements(k).sup_instr(i),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_instr_temp=update_instr_list(sci_instr_temp,instr) + end + sci_instr($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_instr_temp,mtlb_clause.statements(k).nb_opr) + else + [instr,nblines]=instruction2sci(mtlb_clause.statements(k),nblines) + // If inserted instruction is an initialisation, it has to be done just one time and before loop + l=1; + while l<=lstsize(m2sci_to_insert_b) + if typeof(m2sci_to_insert_b(l))=="equal" & .. + (and(m2sci_to_insert_b(l).expression==Cste([])) | .. + and(m2sci_to_insert_b(l).expression==Funcall("struct",1,list(),list())) | .. + and(m2sci_to_insert_b(l).expression==Funcall("cell",1,list(),list())) ) then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + if lstsize(m2sci_to_insert_b)>=l & m2sci_to_insert_b(l)==list("EOL") then + to_insert($+1)=m2sci_to_insert_b(l) + m2sci_to_insert_b(l)=null() + end + else + l=l+1; + end + end + sci_instr=update_instr_list(sci_instr,instr) + end + end + // Create Scilab while + sci_clause=tlist(["for","expression","statements"],sci_expr,sci_instr) + else + error(msprintf(gettext("unknown clause type: %s."),typeof(mtlb_clause))) + end + m2sci_to_insert_b=to_insert + if m2sci_to_insert_b<>list() then + m2sci_to_insert_b($+1)=list("EOL"); + end +endfunction diff --git a/modules/m2sci/macros/kernel/convert2double.bin b/modules/m2sci/macros/kernel/convert2double.bin Binary files differnew file mode 100755 index 000000000..2161e1b88 --- /dev/null +++ b/modules/m2sci/macros/kernel/convert2double.bin diff --git a/modules/m2sci/macros/kernel/convert2double.sci b/modules/m2sci/macros/kernel/convert2double.sci new file mode 100755 index 000000000..1933dac57 --- /dev/null +++ b/modules/m2sci/macros/kernel/convert2double.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 [dble]=convert2double(A) + // This function converts input parameters to double to avoid to write overloading functions in Scilab + + lhs=argn(1) + + if A.vtype==Double then + dble=A + return + end + + if only_double then + dble=A + dble.type=Type(Double,Unknown) + else + if A.vtype==String then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Real))) + dble=Funcall("asciimat",1,Rhs_tlist(A),lhslist) + elseif A.vtype==Boolean then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Real))) + dble=Funcall("bool2s",1,Rhs_tlist(A),lhslist) + elseif A.vtype==Unknown then + lhslist=list(); + lhslist($+1)=Variable("ans",Infer(A.dims,Type(Double,Unknown))) + dble=Funcall("mtlb_double",1,Rhs_tlist(A),lhslist) + else + error(msprintf(gettext("%s is not yet implemented."),string(A.vtype))) + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/default_trad.bin b/modules/m2sci/macros/kernel/default_trad.bin Binary files differnew file mode 100755 index 000000000..a0312b06d --- /dev/null +++ b/modules/m2sci/macros/kernel/default_trad.bin diff --git a/modules/m2sci/macros/kernel/default_trad.sci b/modules/m2sci/macros/kernel/default_trad.sci new file mode 100755 index 000000000..4d9868308 --- /dev/null +++ b/modules/m2sci/macros/kernel/default_trad.sci @@ -0,0 +1,102 @@ +// 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=default_trad(tree) + // M2SCI function + // Create a default translation function + + global("mtlbref_fun") //contains the matlab reference functions which not yet converted + global("mtlbtool_fun")//contains the matlab toolboxes functions + global("not_mtlb_fun") // contains the not matlab functions + + if ~exists("mtlbref_fun") then + mtlb_fun=[] + end + if ~exists("mtlbtool_fun") then + mtlbtool_fun=[] + end + if ~exists("not_mtlb_fun") then + not_mtlb_fun=[] + end + + name=tree.name + + ispriminame=%f; + //true if the name function is the name of scilab function primitive + if funptr(tree.name)<>0 then + name1="%"+tree.name + tree.name=name1 + ispriminame=%t; + end + //ismtlbfun is true if the function is in a matlab toolbox, mtlbpath is the path where is the function + [mtlbpath,ismtlbtoolfun]=mtlbtoolfun(name) + //Matlab reference functions + if or(name==not_yet_converted()) then + set_infos(msprintf(gettext("Matlab function %s not yet converted, original calling sequence used."),name),2) + if ~or(name==mtlbref_fun(:,1)) then + mtlbref_fun($+1,1)=name + if ispriminame then + mtlbref_fun($,2)=msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1); + else + mtlbref_fun($,2)="" + end + end + //Matlab toolboxes functions + elseif ismtlbtoolfun then + set_infos(msprintf(gettext("Matlab toolbox(es) function %s not converted, original calling sequence used"),name),2) + if ~or(name==mtlbtool_fun(:,1)) then + mtlbtool_fun($+1,1)=name + if ispriminame then + mtlbtool_fun($,2)=msprintf(gettext("Matlab toolbox(es) function %s not converted, original calling sequence used."),name,name1,mtlbpath) + else + mtlbtool_fun($,2)=msprintf(gettext("(Find this function in matlab/%s)."),mtlbpath) + end + end + elseif isdefinedvar(Variable(tree.name,Infer())) then + operands=list() + operands(1)=Variable(tree.name,Infer()) + for krhs=1:lstsize(tree.rhs) + operands($+1)=tree.rhs(krhs) + end + tree=Operation("ext",operands,tree.lhs) + tree=operation2sci(tree) + + //Not matlbb function + else + set_infos(msprintf(gettext("Unknown function %s not converted, original calling sequence used."),name),2) + if ~or(name==not_mtlb_fun(:,1)) then + not_mtlb_fun($+1,1)=name + if ispriminame then + not_mtlb_fun($,2)=msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1); + else + not_mtlb_fun($,2)="" + end + end + end + if ispriminame then + set_infos(msprintf(gettext("(Warning name conflict: function name changed from %s to %s)."),name,name1),0) + end + [tree]=sci_generic(tree) +endfunction + + + + + + + + + + + + + + + + diff --git a/modules/m2sci/macros/kernel/equal2sci.bin b/modules/m2sci/macros/kernel/equal2sci.bin Binary files differnew file mode 100755 index 000000000..6cbf3980c --- /dev/null +++ b/modules/m2sci/macros/kernel/equal2sci.bin diff --git a/modules/m2sci/macros/kernel/equal2sci.sci b/modules/m2sci/macros/kernel/equal2sci.sci new file mode 100755 index 000000000..9b2bebc0e --- /dev/null +++ b/modules/m2sci/macros/kernel/equal2sci.sci @@ -0,0 +1,158 @@ +// 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 [sci_instr]=equal2sci(mtlb_instr) + // Convertion of a Matlab instruction or expression to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + // Trees to insert in converted function tree + global("m2sci_to_insert_b") + m2sci_to_insert_b=list() + global("m2sci_to_insert_a") + m2sci_to_insert_a=list() + global("varslist") + + sci_instr=mtlb_instr + + // Add inference data to lhs + lhslist=list() + + // Inference field added to each lhs argument + // Get infos in varslist to init + for k=1:size(mtlb_instr.lhs) + if typeof(mtlb_instr.lhs(k))=="variable" then + [bval,index]=isdefinedvar(mtlb_instr.lhs(k)) + if bval then + INFER=varslist(index).infer + else + INFER=Infer() + end + lhslist($+1)=Variable(mtlb_instr.lhs(k).name,INFER) + elseif typeof(mtlb_instr.lhs(k))=="operation" then + if mtlb_instr.lhs(k).operator<>"ins" then + error(msprintf(gettext("lhs cannot be a %s operation."),mtlb_instr.lhs(k).operator)) + end + + [bval,index]=isdefinedvar(mtlb_instr.lhs(k).operands(1)) + if bval then + INFER=varslist(index).infer + else + INFER=Infer() + end + + lhslist($+1)=Operation(mtlb_instr.lhs(k).operator,.. + mtlb_instr.lhs(k).operands,.. + list(Variable(mtlb_instr.lhs(k).operands(1).name,INFER))) + else + error(msprintf(gettext("lhs cannot be a %s."),typeof(mtlb_instr.lhs(k)))) + end + end + + // Convert expression + + [sci_expr]=expression2sci(mtlb_instr.expression,lhslist); + + if sci_expr==list() then // Conversion made by inserted instructions or 'm2scideclare' + sci_instr=list() + else + + sci_instr.expression=sci_expr; + + // Update lhs of instruction + select typeof(sci_instr.expression) + case "operation" then + sci_instr.lhs=sci_expr.out; + case "funcall" then + sci_instr.lhs=sci_instr.expression.lhs + if typeof(mtlb_instr.expression)=="funcall" then + sci_instr.lhs=sci_expr.lhs; + end + case "cste" then + sci_instr.lhs=lhslist; + sci_instr.lhs(1).dims=sci_expr.dims; + sci_instr.lhs(1).type=sci_expr.type; + case "variable" then + sci_instr.lhs=lhslist; + sci_instr.lhs(1).dims=sci_expr.dims; + sci_instr.lhs(1).type=sci_expr.type; + else + error(msprintf(gettext("%s is not yet implemented."),typeof(sci_instr.expression))); + end + + // If lhs are insertion operation, they also have to be converted + for k=1:size(sci_instr.lhs) + if typeof(sci_instr.lhs(k))=="operation" then + sci_instr.lhs(k).operands($+1)=sci_instr.expression + // Keep just one inference field in sci_instr.expression (if is a funcall) so that inference can be made in operation2sci() + if typeof(sci_instr.lhs(k).operands($))=="funcall" then + for l=1:size(sci_instr.lhs(k).operands($).lhs) + if l<>k then + sci_instr.lhs(k).operands($).lhs(l)=list() + end + end + l=1 + while l<=size(sci_instr.lhs(k).operands($).lhs) + if sci_instr.lhs(k).operands($).lhs(l)==list() then + sci_instr.lhs(k).operands($).lhs(l)=null() + else + l=l+1 + end + end + // Verify that there is just one lhs kept + if size(sci_instr.lhs(k).operands($).lhs)<>1 then pause;end + end + // If insertion made in an unknown variable, I add it to varslist + inservar=sci_instr.lhs(k).operands(1) + [bval,index]=isdefinedvar(inservar) + if ~bval then + // Variable added to varslist before insertion + if funptr(inservar.name)<>0 then + matname="%"+inservar.name + else + matname=inservar.name + end + if sci_instr.expression.vtype==Struct then + // Variable is initialized to struct() in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Struct,Unknown))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Funcall("struct",1,list(),list())) + elseif sci_instr.expression.vtype==Cell then + // Variable is initialized to cell() in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Cell,Unknown))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Funcall("cell",1,list(),list())) + else + // Variable is initialized to [] in converted script is does not already exist + varslist($+1)=M2scivar(matname,inservar.name,Infer(list(0,0),Type(Double,Real))) + //m2sci_to_insert_b($+1)=Equal(list(inservar),Cste([])) + end + sci_instr.lhs(k).out(1).infer=varslist($).infer + else + sci_instr.lhs(k).out(1).infer=varslist(index).infer + end + [sci_instr.lhs(k)]=operation2sci(sci_instr.lhs(k)) + if typeof(sci_instr.lhs(k))=="operation" then + if or(sci_instr.lhs(k).operands($)<>sci_instr.expression) then // Update expression if has been modified while converting lhs + sci_instr.expression=sci_instr.lhs(k).operands($) + end + + sci_instr.lhs(k).operands($)=null() + updatevarslist(sci_instr.lhs(k).out) + else + // Insertion done by inserted instruction + sci_instr=list() + return + end + end + end + // Update varslist + updatevarslist(sci_instr.lhs); + end +endfunction diff --git a/modules/m2sci/macros/kernel/expression2sci.bin b/modules/m2sci/macros/kernel/expression2sci.bin Binary files differnew file mode 100755 index 000000000..aa20981dd --- /dev/null +++ b/modules/m2sci/macros/kernel/expression2sci.bin diff --git a/modules/m2sci/macros/kernel/expression2sci.sci b/modules/m2sci/macros/kernel/expression2sci.sci new file mode 100755 index 000000000..ded4e6b1f --- /dev/null +++ b/modules/m2sci/macros/kernel/expression2sci.sci @@ -0,0 +1,132 @@ +// 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 [sci_expr]=expression2sci(mtlb_expr,lhslist) + // M2SCI function + + // Global variable for M2SCI + global("varslist") + + // When lhslist is given, then expression2sci is called from equal2sci + // else it is called from an other function (clause2sci for example) + rhs=argn(2); + // If not given, lhslist is initialized with no name lhs + if rhs==1 then + if typeof(mtlb_expr)=="funcall" then + lhsnb=mtlb_expr.lhsnb; + else + lhsnb=1; + end + lhslist=list(); + for k=1:lhsnb + lhslist($+1)=Variable("ans",Infer()); + end + end + + select typeof(mtlb_expr) + // --- Expression is an 'operation' tlist --- + case "operation" + // Add inference fields to operation + mtlb_expr=Operation(mtlb_expr.operator,mtlb_expr.operands,lhslist) + + // Translation + [sci_expr]=operation2sci(mtlb_expr) + + // --- Expression is a 'funcall' tlist --- + case "funcall" + + // Particular case if expression is a call to 'm2scideclare' + if mtlb_expr.name=="m2scideclare" then + sci_expr=list() + // varslist is updated with user defined data + sci_m2scideclare(mtlb_expr) + + // Particular case if expression is a call to 'comment' + elseif mtlb_expr.name=="%comment" then + // Add inference fields to funcall + sci_expr=Funcall(mtlb_expr.name,mtlb_expr.lhsnb,mtlb_expr.rhs,lhslist) + // All other 'funcall' expressions + else + // Add inference fields to funcall + mtlb_expr=Funcall(mtlb_expr.name,mtlb_expr.lhsnb,mtlb_expr.rhs,lhslist) + + // Translation + [sci_expr]=funcall2sci(mtlb_expr) + end + + // --- Expression is a 'cste' tlist --- + case "cste" + // Convert expression + sci_expr=Cste(mtlb_expr.value) + + // --- Expression is a 'variable' tlist --- + case "variable" + [bval,index]=isdefinedvar(mtlb_expr) + + // Variable already exists + if bval then + sci_expr=Variable(varslist(index).sciname,varslist(index).infer) + // Variable is unknown + else + // Try to find what is this variable + [sci_expr]=getvar2sci(mtlb_expr,lhslist) + if typeof(sci_expr)=="funcall" then + if typeof(lhslist(1))=="variable" & sci_expr.name==lhslist(1).name then // Used for commands such as keyboard, cputime... + // keyboard in an M-file is represented in tree by an equal with lhs=keyboard and expression=keyboard + sci_expr.lhs(1).name="ans" + elseif typeof(lhslist(1))=="variable" & mtlb_expr.name==lhslist(1).name then // When command converted by mtlb(cmd_name) + sci_expr.lhs(1).name="ans" + end + if sci_expr.name<>"mtlb" then + [sci_expr]=funcall2sci(sci_expr) + end + end + end + // --- operand is a list (only for operations) --- + case "list" + if lstsize(mtlb_expr)==1 & mtlb_expr==list("EOL") then + sci_expr=mtlb_expr + return + end + for k=1:size(mtlb_expr) + if typeof(mtlb_expr(k))=="cste" then + mtlb_expr(k)=Cste(mtlb_expr(k).value) + elseif typeof(mtlb_expr(k))=="variable" then + [isvar,index]=isdefinedvar(mtlb_expr(k)) + if isvar then + mtlb_expr(k)=Variable(mtlb_expr(k).name,varslist(index).infer) + else + mtlb_expr(k)=Variable(mtlb_expr(k).name,Infer()) + end + elseif typeof(mtlb_expr(k))=="list" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + elseif typeof(mtlb_expr(k))=="operation" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + elseif typeof(mtlb_expr(k))=="funcall" then + [mtlb_expr(k)]=expression2sci(mtlb_expr(k),lhslist) + else + error(msprintf(gettext("recursive extraction with one index of type %s is not yet implemented."),typeof(mtlb_expr(k)))) + end + end + sci_expr=mtlb_expr + // --- operand is a comment --- + case "comment" + sci_expr=mtlb_expr + // --- Expression is a not tolerated tlist --- + else + error(msprintf(gettext("%s is not yet implemented."),typeof(mtlb_expr))) + end + + // Verify if flag for translation improvements has to be set + if typeof(sci_expr)=="funcall" then + if part(sci_expr.name,1:4)=="mtlb" then + m2sci_infos(1)=%t // level 1 = improvements + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/first_non_singleton.bin b/modules/m2sci/macros/kernel/first_non_singleton.bin Binary files differnew file mode 100755 index 000000000..168324531 --- /dev/null +++ b/modules/m2sci/macros/kernel/first_non_singleton.bin diff --git a/modules/m2sci/macros/kernel/first_non_singleton.sci b/modules/m2sci/macros/kernel/first_non_singleton.sci new file mode 100755 index 000000000..4d5d80747 --- /dev/null +++ b/modules/m2sci/macros/kernel/first_non_singleton.sci @@ -0,0 +1,26 @@ +// 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 dim=first_non_singleton(m2scitlist) + dim=-1 + if is_a_scalar(m2scitlist) | is_a_vector(m2scitlist) then + dim=0; + return + end + for k=1:size(m2scitlist.dims) + if m2scitlist.dims(k)==0 then + dim=0 + break + elseif m2scitlist.dims(k)>0 & m2scitlist.dims(k)<>1 then + dim=k + break + end + end + +endfunction diff --git a/modules/m2sci/macros/kernel/funcall2sci.bin b/modules/m2sci/macros/kernel/funcall2sci.bin Binary files differnew file mode 100755 index 000000000..1b06ecd50 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcall2sci.bin diff --git a/modules/m2sci/macros/kernel/funcall2sci.sci b/modules/m2sci/macros/kernel/funcall2sci.sci new file mode 100755 index 000000000..56a2af907 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcall2sci.sci @@ -0,0 +1,98 @@ +// 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 [sci_equiv]=funcall2sci(mtlb_expr) + // M2SCI function + // Convert a function call in an instruction or in an expression from Matlab to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + rhslist=mtlb_expr.rhs + if rhslist==[] then // Function called as a command + rhsnb=-1 + rhslist=list() + mtlb_expr.rhs=list() + else + rhsnb=size(rhslist) + end + // Init returned value + sci_expr=mtlb_expr + + rhsind=1 + while rhsind<=rhsnb + [sci_equiv]=expression2sci(rhslist(rhsind)); + mtlb_expr.rhs(rhsind)=sci_equiv; + rhsind=rhsind+1; + end + + // Performs the conversion of function call + lhs=mtlb_expr.lhsnb + if rhsnb==-1 then + rhs=-1 + else + rhs=size(mtlb_expr.rhs) + end + funname=mtlb_expr.name + + // If a translation function exists + if exists("sci_"+funname)==1 then + execstr("[sci_equiv]=sci_"+funname+"(mtlb_expr)"); + // If I don't know where I can search other M-files + elseif res_path==[] then + sci_equiv=default_trad(mtlb_expr) + else + sci_tmpfile =pathconvert(TMPDIR)+pathconvert(fnam)+"sci_"+funname+".sci" + tmpierr=execstr("exec(sci_tmpfile,-1)","errcatch");errclear(); + sci_file=res_path+"sci_"+funname+".sci" + ierr=execstr("exec(sci_file,-1)","errcatch");errclear(); + if tmpierr==0 then + execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)"); + // If a translation function exists + elseif ierr==0 then + execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)"); + // If no translation indication given + elseif Recmode then + // Check if the M-file exists in the given paths + path=mfile_path(funname) + if path==[] then + sci_equiv=default_trad(mtlb_expr) + elseif or(funname==nametbl) + sci_equiv=sci_generic(mtlb_expr) + else + fnam=funname + scipath=res_path+fnam+".sci" + scepath=res_path+fnam+".sce" + catpath=res_path+fnam+".cat" + res=0 + if newest(path,scipath,scepath)==1 then + res=mfile2sci(path,res_path,%F,%T) + end + if res==1 then + exec(sci_file, -1) + ierr=execstr("[sci_equiv]=sci_"+mtlb_expr.name+"(mtlb_expr)","errcatch"); + if ierr<>0 then + error(msprintf(gettext("Error while executing : [sci_equiv]=sci_%s(mtlb_expr)."),mtlb_expr.name)); + end + else + sci_equiv=default_trad(mtlb_expr) + end + end + else // Default translation + sci_equiv=default_trad(mtlb_expr) + end + end + + // If equivalent is a funcall, number of lhs can have changed + if typeof(sci_equiv)=="funcall" then + sci_equiv.lhsnb=size(sci_equiv.lhs) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/funcallsearch.bin b/modules/m2sci/macros/kernel/funcallsearch.bin Binary files differnew file mode 100755 index 000000000..857a7dd71 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcallsearch.bin diff --git a/modules/m2sci/macros/kernel/funcallsearch.sci b/modules/m2sci/macros/kernel/funcallsearch.sci new file mode 100755 index 000000000..3b96282e2 --- /dev/null +++ b/modules/m2sci/macros/kernel/funcallsearch.sci @@ -0,0 +1,104 @@ +// 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 [funcallname,variablename]=funcallsearch(instr,funcallname,fnamvect,variablename) + // + // FUNCALLSEARCH recursive function (used by "translatepaths" function) + // Searches the functions names in each instruction of mtlbtree + // Input-Output + // -funcallname : a vector which contains the names of called functions if it exists a M-file having the same name in the Paths + // -variablename : a vector which contains the names of declared variables + // Input + // -instr : mtlbtree instruction + // -fnamvect : vector which contains all M-files names found in the Paths + + // case : ifthenelse instruction + if typeof(instr) == "ifthenelse" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.then) + [funcallname,variablename]=funcallsearch((instr.then(i)),funcallname,fnamvect,variablename) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + [funcallname,variablename]=funcallsearch((instr.elseifs(i).then(k)),funcallname,fnamvect,variablename) + end + end + for i=1:size(instr.else) + [funcallname,variablename]=funcallsearch((instr.else(i)),funcallname,fnamvect,variablename) + end + // case : selectcase instruction + elseif typeof(instr) == "selectcase" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + + for i=1:size(instr.cases) + [funcallname,variablename]=funcallsearch((instr.cases(i).expression),funcallname,fnamvect,variablename) + for j=1:size(instr.cases(i).then) + [funcallname,variablename]=funcallsearch((instr.cases(i).then(j)),funcallname,fnamvect,variablename) + end + end + for i=1:size(instr.else) + [funcallname,variablename]=funcallsearch(instr.else(i),funcallname,fnamvect,variablename) + end + // case : while instruction + elseif typeof(instr) == "while" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.statements) + [funcallname,variablename]=funcallsearch(instr.statements(i),funcallname,fnamvect,variablename) + end + // case : for instruction + elseif typeof(instr) == "for" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + for i=1:size(instr.statements) + [funcallname,variablename]=funcallsearch(instr.statements(i),funcallname,fnamvect,variablename) + end + // case : cste instruction + elseif typeof(instr)== "cste" then + return + // case : variable instruction + elseif typeof(instr)=="variable" + if find(instr.name==variablename)==[] & find(instr.name==stripblanks(part(fnamvect,1:24)))<>[] & find(instr.name==funcallname)==[] then + funcallname=[funcallname;fnamvect(find(instr.name==stripblanks(part(fnamvect,1:24))))] + else + return + end + // case : equal instruction + elseif typeof(instr) == "equal" then + [funcallname,variablename]=funcallsearch(instr.expression,funcallname,fnamvect,variablename) + // case : expression is a funcall + elseif typeof(instr) == "funcall" then + if find(funcallname==instr.name) == [] & find(instr.name==stripblanks(part(fnamvect,1:24)))<>[] then + if size(find(instr.name==stripblanks(part(fnamvect,1:24))),2)==1 then + funcallname=[funcallname;fnamvect(find(instr.name==stripblanks(part(fnamvect,1:24))))] + else + findvect=find(instr.name==stripblanks(part(fnamvect,1:24))) + funcallname=[funcallname;fnamvect(findvect(2))] + st = " " + mtlbtree.name + ": " + fnamvect(findvect(1)) + for i=2:size(findvect,2) + st = st+ " <-> " + fnamvect(findvect(i)) + end + st = st + gettext(": The 24 first characters of the files names are equal: "); + warning(st) + end + end + // case : expression is cste + if typeof(instr.rhs)== "constant" then + return + else + for ind=1:size(instr.rhs) + [funcallname,variablename]=funcallsearch(instr.rhs(ind),funcallname,fnamvect,variablename) + end + end + // case : operation instruction + elseif typeof(instr) == "operation" then + for ind=1:size(instr.operands) + [funcallname,variablename]=funcallsearch(instr.operands(ind),funcallname,fnamvect,variablename) + end + end + +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/get_unknown.bin b/modules/m2sci/macros/kernel/get_unknown.bin Binary files differnew file mode 100755 index 000000000..aff5c164c --- /dev/null +++ b/modules/m2sci/macros/kernel/get_unknown.bin diff --git a/modules/m2sci/macros/kernel/get_unknown.sci b/modules/m2sci/macros/kernel/get_unknown.sci new file mode 100755 index 000000000..02f1181ee --- /dev/null +++ b/modules/m2sci/macros/kernel/get_unknown.sci @@ -0,0 +1,31 @@ +// 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 [sci_equiv]=get_unknown(varname,lhslist) + // Handle cases where varname appear in an expression while it is not known. + + // nam may be: + // - a variable created in an other clause part + // - a M-file called without args + // - a variable created by an eval + + // Check clause !!! + + // Check if it is a Matlab function not converted yet + if or(varname==not_yet_converted()) then + set_infos(msprintf(gettext("Matlab function %s not yet converted."),varname),2) + tmpvar=Variable(varname,Infer()) + sci_equiv=Funcall("mtlb",1,Rhs_tlist(tmpvar),lhslist) + else + // Other cases: I am not able to determine what is nam + set_infos(msprintf(gettext("mtlb(%s) can be replaced by %s() or %s whether %s is an M-file or not."),varname,varname,varname,varname),1) + tmpvar=Variable(varname,Infer()) + sci_equiv=Funcall("mtlb",1,Rhs_tlist(tmpvar),lhslist) + end +endfunction diff --git a/modules/m2sci/macros/kernel/getoperands.bin b/modules/m2sci/macros/kernel/getoperands.bin Binary files differnew file mode 100755 index 000000000..ed31252d0 --- /dev/null +++ b/modules/m2sci/macros/kernel/getoperands.bin diff --git a/modules/m2sci/macros/kernel/getoperands.sci b/modules/m2sci/macros/kernel/getoperands.sci new file mode 100755 index 000000000..b9f77eabf --- /dev/null +++ b/modules/m2sci/macros/kernel/getoperands.sci @@ -0,0 +1,24 @@ +// 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 [varargout] = getoperands(op_tree) + + varargout=list() + + if typeof(op_tree)<>"operation" then + error(gettext("input argument must be an ''operation'' tlist.")) + end + + opnb=size(op_tree.operands) + + for k=1:opnb + varargout(k)=op_tree.operands(k) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/getrhs.bin b/modules/m2sci/macros/kernel/getrhs.bin Binary files differnew file mode 100755 index 000000000..9d2d21eec --- /dev/null +++ b/modules/m2sci/macros/kernel/getrhs.bin diff --git a/modules/m2sci/macros/kernel/getrhs.sci b/modules/m2sci/macros/kernel/getrhs.sci new file mode 100755 index 000000000..3401a22ce --- /dev/null +++ b/modules/m2sci/macros/kernel/getrhs.sci @@ -0,0 +1,24 @@ +// 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 [varargout] = getrhs(instr_tree) + + varargout=list() + + if typeof(instr_tree)<>"funcall" then + error(gettext("Wrong input argument in getrhs() (Must be a ''funcall'' tlist).")) + end + + rhsnb=size(instr_tree.rhs) + + for k=1:rhsnb + varargout(k)=instr_tree.rhs(k) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/gettempvar.bin b/modules/m2sci/macros/kernel/gettempvar.bin Binary files differnew file mode 100755 index 000000000..43479e444 --- /dev/null +++ b/modules/m2sci/macros/kernel/gettempvar.bin diff --git a/modules/m2sci/macros/kernel/gettempvar.sci b/modules/m2sci/macros/kernel/gettempvar.sci new file mode 100755 index 000000000..699739779 --- /dev/null +++ b/modules/m2sci/macros/kernel/gettempvar.sci @@ -0,0 +1,35 @@ +// 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 var=gettempvar(n) + // M2SCI function + // Create a temporary variable with name depending on clause level... + + global("tmpvarnb") + [lhs,rhs]=argn(0) + + varname="%v"+string(tmpvarnb) + tmpvarnb=tmpvarnb+1 + + // If in the expression of a clause then variable name is modified by adding level + if size(level,1)>1 then + if level(size(level,1))==0 then + varname=varname+string(size(level,1)) + elseif level(size(level,1))>0 then // If in statements of a clause then variable name is modified by adding _level + varname=varname+"_"+string(level(size(level,1))) + end + end + + // User is allowed to precise a variable number + if rhs==1 then + varname=varname+"$"+string(n) + end + + var=Variable(varname,Infer(list(0,0),Type())) +endfunction diff --git a/modules/m2sci/macros/kernel/getvar2sci.bin b/modules/m2sci/macros/kernel/getvar2sci.bin Binary files differnew file mode 100755 index 000000000..6796fa65e --- /dev/null +++ b/modules/m2sci/macros/kernel/getvar2sci.bin diff --git a/modules/m2sci/macros/kernel/getvar2sci.sci b/modules/m2sci/macros/kernel/getvar2sci.sci new file mode 100755 index 000000000..caf989093 --- /dev/null +++ b/modules/m2sci/macros/kernel/getvar2sci.sci @@ -0,0 +1,63 @@ +// 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 [sci_equiv]=getvar2sci(var,lhslist) + // Translate the named variable acquisition + + // Global variable for M2SCI + global("varslist") + + rhs=argn(2) + if rhs<>2 then + error(gettext("Wrong number of inputs.")) + end + + // Search variable name in variable name table + [boolval,index]=isdefinedvar(var) + varname=var.name + + // Variable is not defined yet + if ~boolval then + scinam=varname + + // If Matlab variable name is a function name in Scilab + if funptr(varname)<>0 then + scinam="%"+varname + end + + // Undefined variable may be a M-file or a global variable + // Check if a corresponding M-file exists here + if isanmfile(varname) then + // A M-file without parameter + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s is a M-file."),nblines,varname),-1); + end + sci_equiv=Funcall(varname,size(lhslist),list(),lhslist) + elseif exists("sci_"+varname)==1 then + // A translated function without parameter + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s is a M-file (sci_%s exists)."),nblines,varname,varname),-1); + end + sci_equiv=Funcall(varname,size(lhslist),list(),lhslist) + elseif or(varname==["i","j"]) then + if verbose_mode<0 then + m2sci_info(msprintf(gettext("Variable %s supposed to be the Imaginary unit."),varname),-1); + end + sci_equiv=Variable("%i",Infer(list(1,1),Type(Double,Complex))) + else + // Try to find what is 'varname' + sci_equiv=get_unknown(varname,lhslist) + if verbose_mode<0 then + m2sci_info(msprintf(gettext("L.%d: Unknown variable %s."),nblines,varname),-1); + end + end + else + sci_equiv=Variable(varname,Infer(varslist(index).dims,varslist(index).type)) + end +endfunction diff --git a/modules/m2sci/macros/kernel/i_notation.bin b/modules/m2sci/macros/kernel/i_notation.bin Binary files differnew file mode 100755 index 000000000..0bbd59db5 --- /dev/null +++ b/modules/m2sci/macros/kernel/i_notation.bin diff --git a/modules/m2sci/macros/kernel/i_notation.sci b/modules/m2sci/macros/kernel/i_notation.sci new file mode 100755 index 000000000..c7ae4c9b0 --- /dev/null +++ b/modules/m2sci/macros/kernel/i_notation.sci @@ -0,0 +1,94 @@ +// 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 txt=i_notation(txt) + // This function changes 1i ,... by 1*i,... + + // M2SCI kernel functions called : + // - isinstring + + + // To succeed in this work, we successively suppress occurences which can be proved not to be complex notation + // Until we are 'sure' to have a complex notation + + n=size(txt,"r") + + I="i";J="j" + matches=[string(0:9)+I(ones(1,10)),".i",string(0:9)+J(ones(1,10)),".j"] + symbs=["+","-","*","/","\","(","["," ","^"," ",",",";","=","{"] + s1=["+","-","*","/","\",",",";"," ","^",".","&","|","''","]",")","}"] + s2=[string(0:9),"d","e","D","E","."] + + for k=1:n + st=strindex(txt(k),[";//","//"]) + if st<> [] then + for stk=1:size(st,"*") + if ~isinstring(txt(k),stk) then + break + end + end + continue + end + tk=txt(k)+" " + + // Find possible occurence of complex notation + kc=strindex(tk,matches) + + // Kill indexes which point to non complex values (e.g. : a1item...) + for kk=size(kc,"*"):-1:1 + km=kc(kk)+2 + if find(part(tk,km)==s1)==[] then kc(kk)=[],end + end + + kc=[0 kc] + + for kk=size(kc,"*"):-1:2 + km=kc(kk) + num=%T + // Reads numeric value leading complex variable + while or(part(tk,km)==s2) + km=km-1 + if km<=kc(kk-1)+1 then + km=kc(kk-1); + num=%F; + break + end + end + + tokill=%F + num=part(tk,km+1:kc(kk)-1) + ke=strindex(convstr(num),["e","d"]) + kd=strindex(convstr(num),".") + + // Searching for invalid numeric values (more than one dot...) + if size(ke,2)>1|size(kd,2)>1 then + tokill=%T + elseif size(ke,2)==1&size(kd,2)==1 then + if ke<kd then tokill=%T,end + end + + + if ~tokill then + // If char which follows supposed complex notation is not an operation symbol + if km<>kc(kk-1) then + if and(part(tk,km)<>symbs) then tokill=%T,end + end + end + + if ~tokill then + km=kc(kk) + // If supposed complex notation is not in a string + if ~isinstring(tk,km) then + tk=part(tk,1:km)+"*%"+part(tk,km+1:length(tk)) + end + end + end + txt(k)=tk + end +endfunction diff --git a/modules/m2sci/macros/kernel/infer2txt.bin b/modules/m2sci/macros/kernel/infer2txt.bin Binary files differnew file mode 100755 index 000000000..2b05e16fa --- /dev/null +++ b/modules/m2sci/macros/kernel/infer2txt.bin diff --git a/modules/m2sci/macros/kernel/infer2txt.sci b/modules/m2sci/macros/kernel/infer2txt.sci new file mode 100755 index 000000000..bef0b616f --- /dev/null +++ b/modules/m2sci/macros/kernel/infer2txt.sci @@ -0,0 +1,60 @@ +// 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 txt=infer2txt(infer) + txt=[] + dims=[] + if typeof(infer)=="infer" then + for l=1:size(infer.dims) + dims=[dims,string(infer.dims(l))] + end + else + error(gettext("Not yet implemented.")) + end + dims=strcat(dims," ") + + tp=infer.type.vtype + if tp==1 then + tp="Double" + elseif tp==10 then + tp="String" + elseif or(tp==[4,6]) then + tp="Boolean" + elseif tp==16 then + tp="Struct" + for k=1:lstsize(infer.contents.index) + if typeof(infer.contents.index(k))<>"list" then + txt=[txt;expression2code(list(infer.contents.index(k)))+infer2txt(infer.contents.data(k))] + else + txt=[txt;expression2code(infer.contents.index(k))+infer2txt(infer.contents.data(k))] + end + end + elseif tp==17 then + tp="Cell" + for k=1:lstsize(infer.contents.index) + if typeof(infer.contents.index(k))<>"list" then + txt=[txt;expression2code(list(infer.contents.index(k)))+infer2txt(infer.contents.data(k))] + else + txt=[txt;expression2code(infer.contents.index(k))+infer2txt(infer.contents.data(k))] + end + end + elseif tp==9 then + tp="Handle" + else + tp="Unknown" + end + if infer.type.property==Real then + prop="Real" + elseif infer.type.property==Complex then + prop="Complex" + else + prop="Unknown" + end + txt=["|"+dims+"|"+tp+"|"+prop;txt] +endfunction diff --git a/modules/m2sci/macros/kernel/insert.bin b/modules/m2sci/macros/kernel/insert.bin Binary files differnew file mode 100755 index 000000000..bc4e95a9e --- /dev/null +++ b/modules/m2sci/macros/kernel/insert.bin diff --git a/modules/m2sci/macros/kernel/insert.sci b/modules/m2sci/macros/kernel/insert.sci new file mode 100755 index 000000000..d72cfcdf4 --- /dev/null +++ b/modules/m2sci/macros/kernel/insert.sci @@ -0,0 +1,26 @@ +// 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 []=insert(instr,opt) + + // Global variables for M2SCI + global("m2sci_to_insert_b") + global("m2sci_to_insert_a") + + [lhs,rhs]=argn() + + if rhs==1 then + opt=0 // Insertion before current instruction + end + if opt<>1 then + m2sci_to_insert_b($+1)=instr + else + m2sci_to_insert_a($+1)=instr + end +endfunction diff --git a/modules/m2sci/macros/kernel/instruction2sci.bin b/modules/m2sci/macros/kernel/instruction2sci.bin Binary files differnew file mode 100755 index 000000000..af311919f --- /dev/null +++ b/modules/m2sci/macros/kernel/instruction2sci.bin diff --git a/modules/m2sci/macros/kernel/instruction2sci.sci b/modules/m2sci/macros/kernel/instruction2sci.sci new file mode 100755 index 000000000..903f993fc --- /dev/null +++ b/modules/m2sci/macros/kernel/instruction2sci.sci @@ -0,0 +1,32 @@ +// 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 [converted_instr,nblines]=instruction2sci(mtlb_instr,nblines) + + // Convertion of empty lines + if mtlb_instr==list("EOL") then + converted_instr=list("EOL") + nblines = nblines + 1; + return + end + + if typeof(mtlb_instr)=="equal" then + [converted_instr]=equal2sci(mtlb_instr) + elseif or(typeof(mtlb_instr)==["ifthenelse","selectcase","for","while","trycatch"]) then + [converted_instr,nblines]=clause2sci(mtlb_instr,nblines) + elseif or(typeof(mtlb_instr)==["funcall","cste","operation","variable"]) then + [converted_instr]=expression2sci(mtlb_instr) + elseif typeof(mtlb_instr)=="comment" then + [converted_instr]=mtlb_instr + + else + error(gettext("unknown instruction type %s."),typeof(mtlb_instr)) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/is_a_scalar.bin b/modules/m2sci/macros/kernel/is_a_scalar.bin Binary files differnew file mode 100755 index 000000000..d18b829bd --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_scalar.bin diff --git a/modules/m2sci/macros/kernel/is_a_scalar.sci b/modules/m2sci/macros/kernel/is_a_scalar.sci new file mode 100755 index 000000000..5ad16a005 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_scalar.sci @@ -0,0 +1,24 @@ +// 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 r=is_a_scalar(A) + // M2SCI function + // Checks if all dimensions of A are 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is a scalar) + + n=size(A.dims) + r=%T + for k=1:n + if A.dims(k)<>1 then + r=%F + return + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/is_a_vector.bin b/modules/m2sci/macros/kernel/is_a_vector.bin Binary files differnew file mode 100755 index 000000000..dcae3cbce --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_vector.bin diff --git a/modules/m2sci/macros/kernel/is_a_vector.sci b/modules/m2sci/macros/kernel/is_a_vector.sci new file mode 100755 index 000000000..3c4b01af6 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_a_vector.sci @@ -0,0 +1,27 @@ +// 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 r=is_a_vector(A) + // M2SCI function + // Checks if all dimensions of A but one are 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is a vector) + + nbones=0 + n=size(A.dims) + r=%F + for k=1:n + if A.dims(k)==1 then + nbones=nbones+1 + elseif A.dims(k)==-1 then + return + end + end + r=nbones==n-1 +endfunction diff --git a/modules/m2sci/macros/kernel/is_complex.bin b/modules/m2sci/macros/kernel/is_complex.bin Binary files differnew file mode 100755 index 000000000..81263e6cb --- /dev/null +++ b/modules/m2sci/macros/kernel/is_complex.bin diff --git a/modules/m2sci/macros/kernel/is_complex.sci b/modules/m2sci/macros/kernel/is_complex.sci new file mode 100755 index 000000000..5c804ed89 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_complex.sci @@ -0,0 +1,18 @@ +// 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 r=is_complex(A) + // M2SCI function + // Checks if A is complex + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is complex) + + r=A.property==Complex +endfunction + diff --git a/modules/m2sci/macros/kernel/is_empty.bin b/modules/m2sci/macros/kernel/is_empty.bin Binary files differnew file mode 100755 index 000000000..d19743406 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_empty.bin diff --git a/modules/m2sci/macros/kernel/is_empty.sci b/modules/m2sci/macros/kernel/is_empty.sci new file mode 100755 index 000000000..5f605e37f --- /dev/null +++ b/modules/m2sci/macros/kernel/is_empty.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 r=is_empty(A) + // M2SCI function + // Checks if all A dimension are 0 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is an empty matrix) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)==0 then + nb=nb+1 + end + end + + r=nb==n +endfunction diff --git a/modules/m2sci/macros/kernel/is_real.bin b/modules/m2sci/macros/kernel/is_real.bin Binary files differnew file mode 100755 index 000000000..809de4d86 --- /dev/null +++ b/modules/m2sci/macros/kernel/is_real.bin diff --git a/modules/m2sci/macros/kernel/is_real.sci b/modules/m2sci/macros/kernel/is_real.sci new file mode 100755 index 000000000..8edb3c84f --- /dev/null +++ b/modules/m2sci/macros/kernel/is_real.sci @@ -0,0 +1,18 @@ +// 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 r=is_real(A) + // M2SCI function + // Checks if A real + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A is real) + + r=A.type.property==Real +endfunction + diff --git a/modules/m2sci/macros/kernel/isacomment.bin b/modules/m2sci/macros/kernel/isacomment.bin Binary files differnew file mode 100755 index 000000000..d44b0aeb4 --- /dev/null +++ b/modules/m2sci/macros/kernel/isacomment.bin diff --git a/modules/m2sci/macros/kernel/isacomment.sci b/modules/m2sci/macros/kernel/isacomment.sci new file mode 100755 index 000000000..f70d1ea81 --- /dev/null +++ b/modules/m2sci/macros/kernel/isacomment.sci @@ -0,0 +1,45 @@ +// 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 k=isacomment(txt) + // Find if txt contains a Matlab comment + // If no return 0 + // If yes return the position of the beginning of the comment + + kc=strindex(txt,"%") + k=0 + if kc<>[] then + kq=strindex(txt,quote) + while %t then + qc=size(find(kq<kc(1)),2) // qc = nb of quote placed before the first % + // Even number of quote before first % + if modulo(qc,2)==0 then + k=kc(1) + break + else // There is a single quote before %, have to check for the beginning of the string + while qc>2 then + if (kq(qc-1)==kq(qc)-1) then // Found a '' sequence + qc=qc-2 + else + break + end + end + kk=kq(qc) + if execstr("prev = part(txt,kk-1)","errcatch")<>0 then pause,end;errclear(); + if or(prev==[" ",",",";","=","[","("]) then // qc points on a string beginning + kc(1)=[] + if kc==[] then break,end + else + k=kc(1) + break + end + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/isanmfile.bin b/modules/m2sci/macros/kernel/isanmfile.bin Binary files differnew file mode 100755 index 000000000..4aa97fe3c --- /dev/null +++ b/modules/m2sci/macros/kernel/isanmfile.bin diff --git a/modules/m2sci/macros/kernel/isanmfile.sci b/modules/m2sci/macros/kernel/isanmfile.sci new file mode 100755 index 000000000..baa6b5bcf --- /dev/null +++ b/modules/m2sci/macros/kernel/isanmfile.sci @@ -0,0 +1,46 @@ +// 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 r=isanmfile(nam) + + // Try to find if nam is the name of a M-file + r=%F + + // If a translation function exists + if exists("sci_"+nam)==1 then + r=%T + return + end + + // If this function is part of known untranslated functions + // Special case of untranslated function without arguments + if find(nam==["grid","hold","gca"])<>[] then + r=%T + return + end + + // If recursive mode, try to find M-file in user defined paths + if Recmode then + for k=1:size(Paths,"*") + [u,ierr]=file("open",Paths(k)+nam+".m","old") + if ierr==0 then + file("close",u) + r=%T + break + end + end + else + // Try to find file in working directory + [u,ierr]=file("open",file_path+nam+".m","old") + if ierr==0 then + file("close",u) + end + r=(ierr==0) + end +endfunction diff --git a/modules/m2sci/macros/kernel/isdefinedvar.bin b/modules/m2sci/macros/kernel/isdefinedvar.bin Binary files differnew file mode 100755 index 000000000..010ac9b22 --- /dev/null +++ b/modules/m2sci/macros/kernel/isdefinedvar.bin diff --git a/modules/m2sci/macros/kernel/isdefinedvar.sci b/modules/m2sci/macros/kernel/isdefinedvar.sci new file mode 100755 index 000000000..e0bdca09c --- /dev/null +++ b/modules/m2sci/macros/kernel/isdefinedvar.sci @@ -0,0 +1,65 @@ +// 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 [boolval,index]=isdefinedvar(var) + // Verify if variable is defined in varslist + // Input: + // - var: a M2SCI tlist (funcall, operation...) or a character string (name) for special variables + // Special variables i, j, pi, eps, nargin, nargout + // Output: + // - boolval: + // %T if input tlist is a defined 'variable' (already found while converting M-file) + // %F if input is not a 'variable' or an uknown 'variable' + + // Global variable for M2SCI + global("varslist") + + // level is declared in m2sci.sci and modified in clause2sci.sci + level; + + boolval=%F + index=[] + + // If input is a string + if type(var)==10 then + if and(var<>["i","j","pi","eps","%nargin","%nargout"]) then + warning(msprintf(gettext("Bad use of isdefinedvar() with input: %s."),var)) + return + end + varname=var + else + // If input is not a 'variable', it can be a defined variable... + if typeof(var)=="variable" then + varname=var.name + elseif typeof(var)=="m2scivar" then + varname=var.matname + else + return + end + end + + // Compare with all existing variables varslist + levelsize=size(level,1) + i=0 + while i<levelsize & boolval==%F + for k=1:size(varslist) + // Search a variable which has the same name + if varslist(k).matname==varname then + // Search a variable which is in the same level or in an inferior level + if varslist(k).level==level(1:levelsize-i) then + boolval=%T + index=k + return + end + end + end + i=i+1 + end + +endfunction diff --git a/modules/m2sci/macros/kernel/isinstring.bin b/modules/m2sci/macros/kernel/isinstring.bin Binary files differnew file mode 100755 index 000000000..d2f212696 --- /dev/null +++ b/modules/m2sci/macros/kernel/isinstring.bin diff --git a/modules/m2sci/macros/kernel/isinstring.sci b/modules/m2sci/macros/kernel/isinstring.sci new file mode 100755 index 000000000..25771faf1 --- /dev/null +++ b/modules/m2sci/macros/kernel/isinstring.sci @@ -0,0 +1,78 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - 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 r=isinstring(str,pos) + // Finds if the character pointed by pos is in a string (return %T) or not (return %F) + + str=part(str,1:pos-1) + quote="''" + + // If no quote in before pos + if strindex(str,quote)==[] then + r=%F + return + end + + + ksym=0 + strcnt=0 + qcount=0 // Quote counter + bcount=0 // Bracket counter + pcount=0 // Paranthesis counter + sym=" " + + while %T , + while %T then // Looking for next non white character + if ksym>=pos then + r=strcnt<>0; + return + end + ksym=ksym+1; + psym=sym; // psym = previous symbol + sym=part(str,ksym); + if sym<>" " then break,end + end + + if strcnt<>0 then // If in a string + if sym==quote then + qcount=1 + while part(str,ksym+1)<>quote&ksym+1<pos then // Searching for quote or end of string + ksym=ksym+1 + end + + // 5 following lines added 25/02/2003 (it seemed to work before...) + // if ksym+1<pos then // Added by VC 17/03/2003 because didn't work for following string 'a'.^[1+1i] (pb in i_notation()) + // qcount=qcount+1 + // end // Added by VC 17/03/2003 + while part(str,ksym+1)==quote&ksym+1<pos then // Searching for a sequence of quotes + ksym=ksym+1 + qcount=qcount+1 + end + // End of part added 25/02/2003 + + if 2*int(qcount/2)<>qcount then + strcnt=0 + sym=part(str,ksym) + end + end + elseif sym==quote then + // Check if transpose or beginning of a string + if abs(_str2code(psym))>=36&psym<>")"&psym<>"]"&psym<>"."&psym<>quote then // Not a transpose + strcnt=1 + elseif bcount<>0 then // Inside a matrix definition + if part(str,ksym-1)==" " then strcnt=1,end + end + elseif sym=="[" then + bcount=bcount+1 + elseif sym=="]" then + bcount=bcount-1 + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/lib b/modules/m2sci/macros/kernel/lib Binary files differnew file mode 100755 index 000000000..625e3229d --- /dev/null +++ b/modules/m2sci/macros/kernel/lib diff --git a/modules/m2sci/macros/kernel/lst_funcall.bin b/modules/m2sci/macros/kernel/lst_funcall.bin Binary files differnew file mode 100755 index 000000000..4e515f19e --- /dev/null +++ b/modules/m2sci/macros/kernel/lst_funcall.bin diff --git a/modules/m2sci/macros/kernel/lst_funcall.sci b/modules/m2sci/macros/kernel/lst_funcall.sci new file mode 100755 index 000000000..c02374d3a --- /dev/null +++ b/modules/m2sci/macros/kernel/lst_funcall.sci @@ -0,0 +1,234 @@ +// 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 funcallname=lst_funcall(fil,fnamvect) + // LST_FUNCALL function (used by "translatepaths" function) Creates a list of vectors. The first component of each vector is the name of a M-file (found in the Paths to translate), followed by the called functions by this file + // Output + // -funcallname : a list of vectors + // Input + // -fil : vector which contains all M-files names (path+name) found in the Paths + // -fnamvect : vector which contains all M-files names (just the name) found in the Paths + + quote="''"; + dquote=""""; + + k=strindex(fil,".") + ke=k($)-1 + // Function name + ksep=strindex(fil,sep) + fnam=part(fil,ksep($)+1:ke) // File name without extension + txt=mgetl(fil); + + kf=grep(txt,["function[","function "]) + + if isempty(kf) then + // Batch file + bval=%f + elseif size(kf,"*")==1 then + // Only one function defined + bval=%f + else + funcdecl=[] + for kk=kf + ind=strindex(txt(kk),["function[";"function "]) + if (ind<isacomment(txt(kk)) | isacomment(txt(kk))==0) & ~isinstring(txt(kk),ind) & part(stripblanks(txt(kk),%T),1:8)=="function" then // function prototype + funcdecl=[funcdecl kk] + end + end + if isempty(funcdecl) then + // "function" only exists in comments and strings + bval=%f + elseif size(funcdecl,"*")==1 then + bval=%f + else + bval= %t + end + end + + // file contains more than one function declaration + if bval then + // Verify if the directory exists + sep = filesep(); + dirnam = ls(pathconvert(TMPDIR)); + if or(fnam==dirnam) then + rmdir(pathconvert(TMPDIR)+fnam,"s") + end + mkdir(pathconvert(TMPDIR),fnam) + + write(%io(2),msprintf(gettext(" -- File %s contains more than one function -- "),fil)); + // First split file into as many files as function declared + funcdecl=[funcdecl size(txt,"*")+1] + tmpfiles=[] + for k=1:size(funcdecl,"*")-1 + if k==1 then + functxt=txt(funcdecl(k):funcdecl(k+1)-1) + str= strindex(txt(funcdecl(k)),"(")-1 + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:str(1))) + keq=strindex(funcname,"=") + if ~isempty(keq) then + funcname=stripblanks(part(funcname,keq+1:length(funcname))) + end + mputl(functxt,pathconvert(TMPDIR)+fnam+".m"); + else + functxt=txt(funcdecl(k):funcdecl(k+1)-1) + str=strindex(txt(funcdecl(k)),"(")-1 + if str==-1 then + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:length(txt(funcdecl(k))))) + else + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:str(1))) + end + keq=strindex(funcname,"=") + if ~isempty(keq) then + funcname=stripblanks(part(funcname,keq+1:length(funcname))) + end + tmpfiles=[tmpfiles;funcname] + mputl(functxt,pathconvert(TMPDIR)+pathconvert(fnam)+tmpfiles($)+".m"); + end + end + write(%io(2),msprintf(gettext(" -- Each function converted separately: %s -- "),strcat(tmpfiles," "))); + write(%io(2),msprintf(gettext(" -- Temporary files put in: %s -- "),pathconvert(TMPDIR))); + + // Conversion of each file + //for k=1:size(tmpfiles,"*") + //mfile2sci(pathconvert(TMPDIR)+pathconvert(fnam)+tmpfiles(k)+".m",pathconvert(TMPDIR)+pathconvert(fnam)) + // Delete useless .m files + //mdelete(pathconvert(TMPDIR)+pathconvert(fnam)+tmpfiles(k)+".m") + //end + + translatepaths(pathconvert(TMPDIR)+pathconvert(fnam),pathconvert(TMPDIR)+pathconvert(fnam)) + // Catenation of all .sci files to have only one output file + txt=[] + + for k=1:size(tmpfiles,"*") + txt=[txt ;" ";mgetl(pathconvert(TMPDIR)+pathconvert(fnam)+tmpfiles(k)+".sci")] + mdelete(pathconvert(TMPDIR)+pathconvert(fnam)+tmpfiles(k)+".sci") + end + mputl(txt,pathconvert(TMPDIR)+"tmp_"+fnam+".sci"); + // End of catenation of all .sci files to have only one output file + txt=mgetl(pathconvert(TMPDIR)+pathconvert(fnam)+sep+"log") + mputl(txt,pathconvert(TMPDIR)+"tmp_m2sci_"+fnam+".log"); + // + txt=mgetl(pathconvert(TMPDIR)+pathconvert(fnam)+sep+"resumelog") + mputl(txt,pathconvert(TMPDIR)+"tmp_resume_m2sci_"+fnam+".log"); + + // Catenation of all .log files to have only one output file + // txt=[] + // for k=1:size(tmpfiles,"*") + // txt=[txt ; mgetl(pathconvert(TMPDIR)+pathconvert(fnam)+"m2sci_"+tmpfiles(k)+".log")] + // Delete useless .log files + // mdelete(pathconvert(TMPDIR)+pathconvert(fnam)+"m2sci_"+tmpfiles(k)+".log") + //end + //mputl(txt,pathconvert(TMPDIR)+"tmp_m2sci_"+fnam+".log"); + //End of catenation of all .log files to have only one output file + + // Catenation of all resume.log files to have only one output file + //txt=[] + //for k=1:size(tmpfiles,"*") + //txt=[txt ; mgetl(pathconvert(TMPDIR)+pathconvert(fnam)+"resume_m2sci_"+tmpfiles(k)+".log")] + // Delete useless resume.log files + // mdelete(pathconvert(TMPDIR)+pathconvert(fnam)+"resume_m2sci_"+tmpfiles(k)+".log") + //end + //mputl(txt,pathconvert(TMPDIR)+"tmp_resume_m2sci_"+fnam+".log"); + //End of catenation of all resume.log files to have only one output file + + txt=mgetl(pathconvert(TMPDIR)+fnam+".m") + end + + txt = strsubst(txt, ascii(9), "") + [helppart,txt,batch]=m2sci_syntax(txt) + // save txt vector, helpart and batch after the syntax modification + if strindex(fil,TMPDIR)==[] then + save(pathconvert(TMPDIR)+fnam+".tree",txt,helppart,batch) + end + + funcallname=[] + if txt~=[] then + kc=strindex(txt(1),"function"); + kc=kc(1); + + // Define Scilab function + fprot=funcprot(); + funcprot(0); + + // Blanks in file name are replaced by _ for batch + // kc+9 because 'function ' + + ksc=min(strindex(txt(1),";")) // searching for a comment on first line after function prototype + + if isempty(ksc) then + ksc=length(txt(1))+1; + firstline=[] + else + firstline=part(txt(1),ksc+1:length(txt(1))); + end + + func_proto=part(txt(1),kc+9:ksc-1) + keq=min(strindex(func_proto,"=")) + kpar=min(strindex(func_proto,"(")) + + if isempty(keq) then + keq=0 + end + if isempty(kpar) then + kpar=length(func_proto)+1 + end + + mname=strsubst(stripblanks(part(func_proto,keq+1:kpar-1))," ","_") + func_proto=part(func_proto,1:keq)+.. + strsubst(stripblanks(part(func_proto,keq+1:kpar-1))," ","_")+.. + part(func_proto,kpar:length(func_proto)) + + deff(func_proto,[firstline;txt(2:$)],"n") + w=who("get"); + mname=w(1); + + // Compilation + execstr("comp("+mname+",1)") + + funcprot(fprot) + + // Get Scilab pseudo code of the function + macr=evstr(mname) + + mtlbtree=macr2tree(macr); + + if ~batch then + mtlbtree.name=mname; + else + mtlbtree.name=""; + end + + ninstr=1 + // variablevect is a vector which contains all variables (excluded functions) + variablevect=[] + for i=1:size(mtlbtree.inputs) + variablevect=[variablevect;mtlbtree.inputs(i).name] + end + + // search the declared variables in mtlbtree + while ninstr<=size(mtlbtree.statements)-3 + [variablevect]=variablesearch(mtlbtree.statements(ninstr),variablevect) + ninstr=ninstr+1 + end + + ninstr=1 + // search the called functions in the mtlbtree + // funcallname contains the name of the M-file, followed by the called functions + + while ninstr<=size(mtlbtree.statements)-3 + [funcallname,variablevect]=funcallsearch(mtlbtree.statements(ninstr),funcallname,fnamvect,variablevect) + ninstr=ninstr+1 + end + + end + + // add the M-file name in funcallname vector (at the first index) + funcallname=[fnam;funcallname] + +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/m2sci.bin b/modules/m2sci/macros/kernel/m2sci.bin Binary files differnew file mode 100755 index 000000000..a496adada --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci.bin diff --git a/modules/m2sci/macros/kernel/m2sci.sci b/modules/m2sci/macros/kernel/m2sci.sci new file mode 100755 index 000000000..8282d74dc --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci.sci @@ -0,0 +1,299 @@ +// 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 [scitree,trad,txt,crp]=m2sci(mtlbtree,nam,Recmode,prettyprintoutput) + // This function translates Matlab interpreted code tree of a function to Scilab + // Input arguments: + // - mtlbtree: tree (returned by macr2tree) representing Matlab function compiled code + // - nam: name of Matlb function + // - Recmode: boolean flag for recursive conversion if TRUE + // - prettyprintoutput: boolean flag for pretty printed output file if TRUE + // Output arguments: + // - scitree: Scilab equivalent for mtlbtree + // - trad: code of function sci_<nam> + // - txt: Scilab equivalent function code (function declaration and varaibles initialisation) + // - crp: Scilab equivalent function code (function body) + + [lhs,rhs]=argn(0) + if rhs==1 then + error(gettext("Wrong number of inputs.")) + end + if rhs==2 then Recmode=%f,end + + lcount=1; + + // Level of clause indentation (used for getting temporary variables and for updating varslist) + // if there is not a clause then size of level = 1 and the value is 0 (level=0) + // add one size at level each time a new clause is found + // if just one clause then size of level = 2, the value of level(2) : the index of clause part for the first clause (1 for 'if' statements, 2 for first 'elseif' statements, 3 for first 'elseif' statements,...) + // if there are 2 clauses, then size of level = 3, the value of level(3) : the index of clause part for the second clause (1 for if statements, 2 for first elseif statements, 3 for second elseif statements,...) + // for example : level = [0,4,1] : in this case there are 2 clauses the index for the first clause (i.e level(2)) is 4 (4 for second 'elseif' statements), the index for the second clause (i.e level(3)) is 1 (1 for 'if' statements) + // the first components of level (i.e level(1)) is always 0 (because in the zero level there is no clause, so there is no 'if' no 'elseif' no 'else') + level=0 + + // Parameters declaration + sciparam() + + // Scilab variable types + Double=1; + Boolean=4; // Boolean type can also be 6 + Sparse=5; + Int=8; + Handle=9; + String=10; + Cell=17; + Struct=16; + Void=0; + Unknown=-1; // Unknown type or dimension + SupToOne=-2; // Dimension >1 + NotNull=-3; // Dimension >0 + Complex=1 //"Complex" + Real=0 //"Real" + Units=["pixels","centimeters","points","inches","normalized"] + + global %graphics + %graphics=struct() + %graphics.type=Double + %graphics.units="pixels" + + // Translated function input arguments + macrhs=size(mtlbtree.inputs) + global("varslist") + varslist=list() + for k=1:macrhs + if funptr(mtlbtree.inputs(k).name)<>0 then // Matlab variable name corresponding to a Scilab function name + varslist($+1)=M2scivar("%"+mtlbtree.inputs(k).name,mtlbtree.inputs(k).name,Infer()) + mtlbtree.inputs(k).name="%"+mtlbtree.inputs(k).name, + elseif mtlbtree.inputs(k).name=="varargin" then + varslist($+1)=M2scivar("varargin","varargin",Infer(list(Unknown,Unknown),Type(Cell,Unknown))) + else + varslist($+1)=M2scivar(mtlbtree.inputs(k).name,mtlbtree.inputs(k).name,Infer()) + end + end + // Add predefined variables in the defined variables + varslist($+1)=M2scivar("%i","%i",Infer(list(1,1),Type(Double,Complex))) + varslist($+1)=M2scivar("%i","%j",Infer(list(1,1),Type(Double,Complex))) + varslist($+1)=M2scivar("%nan","NaN",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%nan","nan",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%inf","Inf",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%inf","inf",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("$","end",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%pi","pi",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("%eps","eps",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("varargout","%varargout",Infer(list(Unknown,Unknown),Type(Cell,Unknown))) + varslist($+1)=M2scivar("%shortcircuit","%shortcircuit",Infer(list(1,1),Type(Double,Real))) // Used for short circuiting operators + + // Translated function output arguments + maclhs=size(mtlbtree.outputs) + for k=1:maclhs + if funptr(mtlbtree.outputs(k).name)<>0 then + varslist($+1)=M2scivar("%"+mtlbtree.outputs(k).name,mtlbtree.outputs(k).name,Infer(list(0,0),Type(Double,Real))) + mtlbtree.outputs(k).name="%"+mtlbtree.outputs(k).name + else + varslist($+1)=M2scivar(mtlbtree.outputs(k).name,mtlbtree.outputs(k).name,Infer(list(0,0),Type(Double,Real))) + end + end + + // Translation + [scitree,crp]=mtlbtree2sci(mtlbtree,prettyprintoutput) + + dcl=[] + // Add special code + // If nargin or nargout function is used + if isdefinedvar("%nargin") | isdefinedvar("%nargout") then + dcl=["";gettext("// Number of arguments in function call");"[%nargout,%nargin] = argn(0)"] + end + + // Set display mode equivalent to Matlab echo off + dcl=[dcl;"";gettext("// Display mode");"mode(0);"] + // Set flotting point exception mode + dcl=[dcl;"";gettext("// Display warning for floating point exception");"ieee(1);"] + + // Initial value of lhs arguments + // If they are not initialized by input value, they are initialized with [] + ini=[] + for k=1:size(mtlbtree.outputs) + found=%F + for l=1:size(mtlbtree.inputs) + if mtlbtree.inputs(l).name==mtlbtree.outputs(k).name then + found=%T + end + end + if ~found then + if mtlbtree.outputs(k).name<>"varargout" then + ini=[ini;mtlbtree.outputs(k).name+"=[];"] + else + ini=[ini;mtlbtree.outputs(k).name+"=list();"] + end + end + end + + // Graphics init + //graph_ini=[gettext("// Graphics initialisation");"global %graphics";"%graphics.type=1";"%graphics.units=""pixels"""]; + graph_ini=[] + if ini<>[] then + ini=["";gettext("// Output variables initialisation (not found in input variables)");ini] + end + //ini=[ini;" ";graph_ini] + + // Info on macros variables + if verbose_mode<0 then + write(%io(2),gettext("TESTING M2SCI: creating varslist file...")) + n=size(varslist) + info=[] + + for k=1:n + info=[info;"//"+varslist(k).sciname+infer2txt(varslist(k).infer)]; + end + infofilename=res_path+nam+"_varslist.dia.ref"; + if verbose_mode==-2 then + write(%io(2),info) + end + infofile=mopen(infofilename,"w"); + mputl(info,infofile); + mclose(infofile); + end + + // Add function header + if ~batch then + rhsexpr="(" + for k=1:macrhs + rhsexpr=rhsexpr+varslist(k).sciname + if k<macrhs then + rhsexpr=rhsexpr+"," + end + end + rhsexpr=rhsexpr+")" + hdr="function [" + for k=1:size(mtlbtree.outputs) + hdr=hdr+mtlbtree.outputs(k).name + if k<>size(mtlbtree.outputs) then + hdr=hdr+"," + end + end + hdr=hdr+"] = "+nam+rhsexpr; + txt=[hdr;ini;dcl] + else + txt=[ini;dcl] + end + + // Generate associated translation function + if batch then + trad=[ + "function [tree] = sci_"+fnam+"(tree)" + msprintf(gettext("// Generated by M2SCI\n// Conversion function for Matlab %s\n// Input: tree = Matlab funcall tree\n// Output: tree = Scilab equivalent for tree"),fnam) + "" + "tree=Funcall(""exec"",1,Rhs_tlist(tree.name),tree.lhs)" + ] + else + trad=[ + "function [tree] = sci_"+nam+"(tree)" + msprintf(gettext("// Copyright INRIA (Generated by M2SCI)\n// Conversion function for Matlab %s()\n// Input: tree = Matlab funcall tree\n// Output: tree = Scilab equivalent for tree"),nam) + ] + + if maclhs==0 then // Function with no outputs + // Do nothing + elseif maclhs==1 then // Function with one output + [boolval,index]=isdefinedvar(M2scivar(mtlbtree.outputs(1).name,strsubst(mtlbtree.outputs(1).name,"%",""),Infer())) + if boolval then + dims=sci2exp(varslist(index).dims) + vtype=varslist(index).vtype + prop=varslist(index).property + else + dims="list(Unknown,Unknown)" + vtype=Unknown + prop=Unknown + end + + select vtype + case Double then vtype="Double" + case Boolean then vtype="Boolean" + case String then vtype="String" + case Struct then vtype="Struct" + case Cell then vtype="Cell" + case Unknown then vtype="Unknown" + case Sparse then vtype="Sparse" + end + + select prop + case -1 then prop="Unknown" + case 0 then prop="Real" + case 1 then prop="Complex" + end + + typ="Type("+vtype+","+prop+")" + + if mtlbtree.outputs($).name<>"varargout" then + trad=[trad;"tree.lhs(1).dims="+dims;"tree.lhs(1).type="+typ] + else + trad=[trad; + "for k=1:lhs" + " tree.lhs(k).dims=list(Unknown,Unknown)" + " tree.lhs(k).vtype=Unknown" + " tree.lhs(k).property=Unknown" + "end" + ] + end + else // Function with more than 1 output + dims=list(); + vtype=[]; + prop=[] + for k=1:maclhs + [boolval,index]=isdefinedvar(M2scivar(mtlbtree.outputs(k).name,strsubst(mtlbtree.outputs(k).name,"%",""),Infer())) + if boolval then + dims(k)=varslist(index).dims + vtype=[vtype;varslist(index).vtype] + prop=[prop;varslist(index).property] + else + dims(k)=list(Unknown,Unknown) + vtype=[vtype;Unknown] + prop=[prop;Unknown] + end + end + + dimstemp=sci2exp(dims) + dims=["dims="+dimstemp(1);dimstemp(2:$)] + vtype="vtype="+sci2exp(vtype) + prop="prop="+sci2exp(prop) + trad=[trad; + gettext("// dims(i,:) is the ith output argument dimensions vector") + dims + gettext("// dims(i,:) is the ith output argument dimensions vector") + vtype + gettext("// prop(i) is the ith output argument property") + prop] + if mtlbtree.outputs($).name<>"varargout" then + trad=[trad; + "for k=1:lhs" + " tree.lhs(k).dims=dims(k)" + " tree.lhs(k).vtype=vtype(k)" + " tree.lhs(k).property=prop(k)" + "end" + ] + else + trad=[trad; + "for k=1:min(lstsize(dims),lhs)" + " tree.lhs(k).dims=dims(k)" + " tree.lhs(k).vtype=vtype(k)" + " tree.lhs(k).property=prop(k)" + "end" + gettext("// Inference for varargout") + "for k=min(lstsize(dims),lhs)+1:lhs" + " tree.lhs(k).dims=list(Unknown,Unknown)" + " tree.lhs(k).vtype=Unknown" + " tree.lhs(k).property=Unknown" + "end" + ] + end + end + end + trad=[trad;"endfunction"] + clearglobal varslist + clearglobal %graphics +endfunction diff --git a/modules/m2sci/macros/kernel/m2sci_info.bin b/modules/m2sci/macros/kernel/m2sci_info.bin Binary files differnew file mode 100755 index 000000000..3c8c33632 --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_info.bin diff --git a/modules/m2sci/macros/kernel/m2sci_info.sci b/modules/m2sci/macros/kernel/m2sci_info.sci new file mode 100755 index 000000000..e27fadc56 --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_info.sci @@ -0,0 +1,45 @@ +// 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 m2sci_info(txt,verb_mode) + // verb_mode=0: no information displayed + // verb_mode=1: information written as comment is resulting SCI-file + // verb_mode=2: information written as comment is resulting SCI-file and in logfile + // verb_mode=3: information written as comment is resulting SCI-file, in logfile and displayed in Scilab window + // verb_mode=-1: information written in logfile and displayed in Scilab window (should not be used by user) (TEST MODE) + // verb_mode=-2: information written in logfile and displayed in Scilab window (should not be used by user) and varslist displayed in Scilab command window (DEBUG MODE) + + + + if verb_mode==0 then + return + end + + if verb_mode>0 then + if exists("m2sci_to_insert_b")==0 then + write(%io(2),gettext("loginfos: verb_mode 0 should not be used in this context, information ignored.")); + return + end + global("m2sci_to_insert_b") + for k=1:size(txt,"*") + m2sci_to_insert_b($+1)=Equal(.. + list(Variable("ans",Infer())),.. + Funcall("%comment",1,list(Cste(" "+txt(k))),list(Variable("",Infer())))) + m2sci_to_insert_b($+1)=list("EOL"); + end + end + + if verb_mode>1 | verb_mode==-1 then + write(logfile,margin+txt); // margin is defined in mfile2sci() + end + + if verb_mode>2 | verb_mode==-1 then + mprintf("%s\n",strsubst(strsubst(margin+txt, "%i", "%%i"),"%n","%%n")); // margin is defined in mfile2sci() + end +endfunction diff --git a/modules/m2sci/macros/kernel/m2sci_syntax.bin b/modules/m2sci/macros/kernel/m2sci_syntax.bin Binary files differnew file mode 100755 index 000000000..e517dd610 --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_syntax.bin diff --git a/modules/m2sci/macros/kernel/m2sci_syntax.sci b/modules/m2sci/macros/kernel/m2sci_syntax.sci new file mode 100755 index 000000000..d9f5aca6f --- /dev/null +++ b/modules/m2sci/macros/kernel/m2sci_syntax.sci @@ -0,0 +1,455 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - 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 [helppart,txt,batch]=m2sci_syntax(txt) + // Make minor changes on M-file data syntax to have it readable by Scilab + // Input arguments: + // - txt: the contents of an M-file + // Output: + // - helppart: Matlab help contained in M-file + // - txt: input txt modified (If M-file contains only comments returned txt is[]) + // - batch: boolean flag indicates if it is a batch file + + // m2sci kernel functions called : + // - isacomment + // - isinstring + // - replace_brackets + + sciparam(); + quote="''" + dquote="""" + ctm="."+"."+"." // Continuation mark + batch=%t + + k=0 + first_ncl=[] + while k<size(txt,"r") + k=k+1 + tk=txt(k) + if part(stripblanks(tk),1:9) == "function " | part(stripblanks(tk),1:9) == "function[" then + eolind=strindex(tk,";") + if eolind<>[] then + kc=isacomment(tk) + if kc<>0 then // Current line has or is a comment + // If function prototype immediately followed by a comment on same line + if stripblanks(part(tk,eolind(1):kc))<>"" then + txt=[txt(1:k-1);part(tk,1:eolind(1)-1);part(tk,eolind(1)+1:length(tk));txt(k+1:size(txt,"*"))] + tk=part(tk,1:eolind(1)-1) + end + elseif stripblanks(part(tk,eolind(1)+1:length(tk)))<>"" then + txt=[txt(1:k-1);part(tk,1:eolind(1)-1);part(tk,eolind(1)+1:length(tk));txt(k+1:size(txt,"*"))] + tk=part(tk,1:eolind(1)-1) + end + end + end + end + + // Number of lines in txt (i.e. in M-file) + n=size(txt,"r") + eoltoinsert=0 + firstctm=[] + k=0 + while k<size(txt,"r") + k=k+1 + kc=strindex(txt(k),ctm) + isacontline=%f + + for kck=kc, + kc1=isacomment(txt(k)) + if ~isinstring(txt(k),kck) then + if kc1<>0 then // Line has a comment + if kc1<kck then // Continuation mark in a comment + else // Comment follow continuation mark + com=part(txt(k),kc1(1):length(txt(k))) + txt(k)=part(txt(k),1:kck-1)+txt(k+1)+com + txt(k+1)=[] + k=k-1 + break + end + else // Not a comment line + if isempty(firstctm) then firstctm=k;end + txt(k)=part(txt(k),1:kck-1)+txt(k+1) + txt(k+1)=[] + eoltoinsert=eoltoinsert+1 + if isempty(strindex(txt(k),ctm)) then // If no ctm in txt(k), insert all necessary EOL to keep nblines unchanged + for l=0:eoltoinsert-1 + txt=[txt(1:firstctm-1+l);"";txt(firstctm-1+l+1:$)] + end + eoltoinsert=0 + firstctm=[] + end + k=k-1 + break + end + end + end + if k<>0 then + if part(stripblanks(txt(k)),1)=="}" then + txt(k-1)=txt(k-1)+txt(k); + txt(k)=""; + end + end + end + + // Change comments and get help part in input txt + n=size(txt,"r") + first=%t + helppart=[],endofhelp=%f + + for k=1:n + tk=txt(k) + + // ifthenelse expression like if (x==1)t=2 becomes if (x==1) t=2 + // Add a blank between parenthesize expression and the first instruction + kif=strindex(tk,"if") + if kif<>[] then + kcom=isacomment(tk) + for i=1:size(kif,"*") + if kif(i)>kcom & kcom<>0 then + break + else + if (kif(i)>1 & or(stripblanks(part(tk,kif(i)-1:kif(i)+2))==["if(","if"])) | (kif(i)==1 & or(stripblanks(part(tk,kif(i):kif(i)+2))==["if(","if"])) + m=min(strindex(tk,"(")) + if m<>[] then + for l=1:size(m,"*") + if m(l)>=kif(i)+2 + if stripblanks(part(tk,kif(i)+2:m(l)))=="(" then + openpar=1 + mtemp=m(l)+1 + while openpar<>0 + if or(part(tk,mtemp)=="(") then + openpar=openpar+1 + elseif or(part(tk,mtemp)==")") then + openpar=openpar-1 + end + mtemp=mtemp+1 + end + tk=part(tk,1:mtemp-1)+" "+part(tk,mtemp:length(tk)) + break + end + end + end + end + end + end + end + end + + // Insert a blank when a digit is followed by a dotted operator + // So that point is associated to operator and not to digit + // Because if it is associated to digit, dot is suppressed by comp() + kdot=strindex(tk,[".*","./",".\",".^",".''"]) + if kdot<>[] then + kdgt=kdot(find(abs(_str2code(part(tk,kdot-1)))<9)) + for kk=size(kdgt,"*"):-1:1 + tk=part(tk,1:kdgt(kk)-1)+" "+part(tk,kdgt(kk):length(tk)); + end + end + + // Modify struct like x.(fieldname) which become x(fieldname) + tk=strsubst(tk,".(","(") + + // Parenthesize calls to pause when pause on or pause off + kpause=strindex(tk,"pause") + kpsav=length(tk) // kpsave is kp value for l-1 index + for l=size(kpause,"*"):-1:1 + kp=kpause(l) + kon=strindex(tk,"on") + kon=kon(find((kon>kp)&(kon<kpsav))) + if kon<>[] then + for l=kp+5:kon-1 + if part(tk,l)<>" " then + break + end + end + tk=part(tk,1:kp+4)+"(''on'')"+part(tk,kon+2:length(tk)) + end + koff=strindex(tk,"off") + koff=koff(find((koff>kp)&(koff<kpsav))) + if koff<>[] then + for l=kp+5:koff-1 + if part(tk,l)<>" " then + break + end + end + tk=part(tk,1:kp+4)+"(''off'')"+part(tk,koff+3:length(tk)) + end + kpsav=kp + end + + // Convert @fhandle to 'fhandle' (cf feval) + symbs=[" ",",",";","=",")","]"] + kpunct=strindex(tk,"@") + kcom=isacomment(tk) + if kcom<>0 then + kpunct=kpunct(kpunct<kcom) + end + if kpunct<>[] then + for l=size(kpunct,"*"):-1:1 + if ~isinstring(tk,kpunct(l)) then + kk=gsort(strindex(tk,symbs),"r","i") + kk=kk(find(kk>kpunct(l))) + if kk==[] then + kk=length(tk) + tk=part(tk,1:kpunct(l)-1)+quote+part(tk,kpunct(l)+1:kk)+quote + else + kk=kk(1) + tk=part(tk,1:kpunct(l)-1)+quote+part(tk,kpunct(l)+1:kk-1)+quote+part(tk,kk:length(tk)) + end + end + end + end + + // Looking for comments + kc=isacomment(tk) + if kc<>0 then // Current line has or is a comment + // If function prototype immediately followed by a comment on same line + if part(stripblanks(tk),1:9) == "function " | part(stripblanks(tk),1:9) == "function[" then + first_ncl=k + end + com=part(tk,kc+1:length(tk)) + if stripblanks(part(tk,1:kc-1))<>"" & ~(stripblanks(part(tk,1:9))=="function " | stripblanks(part(tk,1:9))=="function[") then endofhelp=%t;end + if ~endofhelp & part(tk,1:9) ~= "function " then helppart=[helppart;com];end // Get help part placed at the beginning of the file + if length(com)==0 then com=" ",end + com=strsubst(com,quote,quote+quote) + com=strsubst(com,dquote,dquote+dquote) + if part(com,1:12)=="m2sciassume " | part(com,1:13)=="m2scideclare " then // User has given a clue to help translation + if part(com,1:12)=="m2sciassume " then + warning(gettext("m2sciassume is obsolete, used m2scideclare instead.")); + end + com=";m2scideclare("+quote+part(com,13:length(com))+quote+")" + else + com=";//"+com + end + tkbeg=part(tk,1:kc-1) + + // Short circuiting operators + if ~isempty(strindex(tkbeg,"||")) then + orexpr=tokens(tkbeg,"|") + boolendsymbol=%f + orexprtemp=orexpr($) + indendsymbol=strindex(orexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(orexpr($),indendsymbol($)+1:length(orexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(orexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + orexpr($)=part(orexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(orexpr,"*") + notsymbol=strindex(stripblanks(orexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + orexpr(i)="("+ stripblanks(orexpr(i)) + ")" + end + end + end + for kk=2:2:size(orexpr,"*") + orexpr=[orexpr(1:kk);"%shortcircuit";orexpr(kk+1:size(orexpr,"*"))] + end + tkbeg=strcat(orexpr,"|") + if boolendsymbol then + tkbeg=tkbeg+endsymbol + end + end + if ~isempty(strindex(tkbeg,"&&")) then + andexpr=tokens(tkbeg,"&") + boolendsymbol=%f + andexprtemp=andexpr($) + indendsymbol=strindex(andexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(andexpr($),indendsymbol($)+1:length(andexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(andexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + andexpr($)=part(andexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(andexpr,"*") + notsymbol=strindex(stripblanks(andexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + andexpr(i)="("+ stripblanks(andexpr(i)) + ")" + end + end + end + for kk=2:2:size(andexpr,"*") + andexpr=[andexpr(1:kk);"%shortcircuit";andexpr(kk+1:size(andexpr,"*"))] + end + tkbeg=strcat(andexpr,"&") + if boolendsymbol then + tkbeg=tkbeg+endsymbol + end + end + + // varargout replaced by %varargout so that code can be compiled with varargout considered as a Cell + if isempty(strindex(tkbeg,"function")) then + tkbeg=strsubst(tkbeg,"varargout","%varargout") + end + + txt(k)=tkbeg+com + else // Current line has not and is not a comment line + if first then // Function keyword not yet found + tk=stripblanks(tk) + if tk<>"" then // Current line is not a blank line + if ~(part(tk,1:9) == "function "| part(tk,1:9) == "function[") then + endofhelp=%t; + txt(k)=tk; // VC 01/04/2003 + else + first_ncl=k + first=%f + end + else + if ~endofhelp then helppart=[helppart;" "],end + txt(k)="// " + end + else // Current line is a line after function keyword + endofhelp=%t + txt(k)=tk + end + + // Short circuiting operators + if ~isempty(strindex(tk,"||")) then + orexpr=tokens(tk,"|") + indendsymbol=strindex(orexpr($),[";",","]) + boolendsymbol=%f + if indendsymbol<>[] then + if stripblanks(part(orexpr($),indendsymbol($)+1:length(orexpr($))))=="" then + boolendsymbol=%t + indendsymbol=indendsymbol($) + endsymbol=part(orexpr($),indendsymbol($)) + orexpr($)=part(orexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(orexpr,"*") + notsymbol=strindex(stripblanks(orexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + orexpr(i)="("+ stripblanks(orexpr(i)) + ")" + end + end + end + for kk=2:2:size(orexpr,"*") + orexpr=[orexpr(1:kk);"%shortcircuit";orexpr(kk+1:size(orexpr,"*"))] + end + tk=strcat(orexpr,"|") + if boolendsymbol then + tk=tk+endsymbol + end + end + if ~isempty(strindex(tk,"&&")) then + andexpr=tokens(tk,"&") + boolendsymbol=%f + andexprtemp=andexpr($) + indendsymbol=strindex(andexpr($),[";",","]) + if indendsymbol<>[] then + if stripblanks(part(andexpr($),indendsymbol($)+1:length(andexpr($))))=="" then + boolendsymbol=%t + endsymbol=part(andexprtemp,indendsymbol($)) + indendsymbol=indendsymbol($) + andexpr($)=part(andexpr($),1:indendsymbol($)-1) + end + end + for i=2:size(andexpr,"*") + notsymbol=strindex(stripblanks(andexpr(i)),"~") + if notsymbol<>[] + if notsymbol(1)==1 then + andexpr(i)="("+ stripblanks(andexpr(i)) + ")" + end + end + end + for kk=2:2:size(andexpr,"*") + andexpr=[andexpr(1:kk);"%shortcircuit";andexpr(kk+1:size(andexpr,"*"))] + end + tk=strcat(andexpr,"&") + if boolendsymbol then + tk=tk+endsymbol + end + end + + // varargout replaced by %varargout so that code can be compiled with varargout considered as a Cell + if isempty(strindex(tk,"function")) then + tk=strsubst(tk,"varargout","%varargout") + end + + txt(k)=tk + end + end + + // When there is just help line in txt + if ~endofhelp then + txt=[] + return + end + + // Syntax modification + + // Complex variable + txt=i_notation(txt) + + // Replace double quotes + txt=strsubst(txt,dquote,dquote+dquote) + + // Replace switch by select + txt=strsubst(txt,"switch ","select ") + txt=strsubst(txt,"switch(","select (") + + // Replace otherwise by else + txt=strsubst(txt,"otherwise","else") + + // Replace {..} by (..) or [..] : useful for cells translation + txt=replace_brackets(txt) + + // Place function definition line at first line + kc=strindex(txt(first_ncl),"function") + if kc==[] then + // Batch file + txt=["function []="+fnam+"()";txt] // fnam is defined in mfile2sci() + batch=%t + else + kc=kc(1) + batch=%f + if first_ncl<>1 then + while strindex(txt(first_ncl($)+1),ctm)<>[] then + first_ncl=[first_ncl,first_ncl($)+1] + end + txt=[txt(first_ncl);txt(1:first_ncl(1)-1);txt(first_ncl($)+1:$)] + end + // Beginning of BUG 2341 fix: function prototype with no comma between output parameters names + begb=strindex(txt(1),"["); + endb=strindex(txt(1),"]"); + if ~isempty(begb) & ~isempty(endb) + outputparams = stripblanks(part(txt(1),(begb+1):(endb-1)))+" "; + k=0; + while k<length(outputparams) + k=k+1; + while (and(part(outputparams,k)<>[","," "])) & (k<length(outputparams)) // skip identifier + k=k+1; + end + while (part(outputparams,k)==" ") & (k<length(outputparams)) // skip spaces before comma (or next identifier) + k=k+1; + end + if (part(outputparams,k)<>",") & (k<length(outputparams)) + outputparams=part(outputparams,1:(k-1))+","+part(outputparams,k:length(outputparams)); + k=k+1; + else + k=k+1; + while (part(outputparams,k)==" ") & (k<length(outputparams)) // skip spaces after comma + k=k+1; + end + end + end + txt(1)=stripblanks(part(txt(1),1:begb)+outputparams+part(txt(1),endb:length(txt(1)))); + end + // END of BUG 2341 fix: function prototype with no comma between output parameters names + end + +endfunction diff --git a/modules/m2sci/macros/kernel/mfile_path.bin b/modules/m2sci/macros/kernel/mfile_path.bin Binary files differnew file mode 100755 index 000000000..c9e19d315 --- /dev/null +++ b/modules/m2sci/macros/kernel/mfile_path.bin diff --git a/modules/m2sci/macros/kernel/mfile_path.sci b/modules/m2sci/macros/kernel/mfile_path.sci new file mode 100755 index 000000000..26702ae78 --- /dev/null +++ b/modules/m2sci/macros/kernel/mfile_path.sci @@ -0,0 +1,21 @@ +// 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 path=mfile_path(nam) + fil=nam+".m";nf=length(fil) + path=[]; + for k=1:size(mfiles,"*") + pk=mfiles(k); + kk=strindex(pk,"/"); + if fil==part(pk,kk($)+1:length(pk)) then + path=pk; + break + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/mtlbtoolfun.bin b/modules/m2sci/macros/kernel/mtlbtoolfun.bin Binary files differnew file mode 100755 index 000000000..cbf8a0664 --- /dev/null +++ b/modules/m2sci/macros/kernel/mtlbtoolfun.bin diff --git a/modules/m2sci/macros/kernel/mtlbtoolfun.sci b/modules/m2sci/macros/kernel/mtlbtoolfun.sci new file mode 100755 index 000000000..190c5dd90 --- /dev/null +++ b/modules/m2sci/macros/kernel/mtlbtoolfun.sci @@ -0,0 +1,3653 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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 [mtlbpath,ismtlb]=mtlbtoolfun(namefun) + //This function return true if the function namefun is in a matlab toolbox and determinates the access path + //Input: + //namefun : the name of the function + //Output : + //mtlbpath : the path where is the function in the matlab toolbox (if it is in matlab) + //ismtlb : boolean, true if the function is in a matlab toolbox + + mtlbpath=gettext("not matlab path"); + ismtlb=%f + + //tb : table which contains all the matlab functions(exept the matlab function reference) and their access path + tb=["CreateCellAttrib" , "toolbox/slcontrol/slctrlguis/"; + "FreqVectorCheck" , "toolbox/control/ctrlguis/"; + "SignalConstrMask" , "toolbox/sloptim/sloptim/"; + "TimeVectorCheck" , "toolbox/control/ctrlguis/"; + "abcbalance" , "toolbox/control/ctrlutil/"; + "abccheck" , "toolbox/ident/idutils/"; + "aboutcst" , "toolbox/control/ctrlguis/"; + "aboutidenttbx" , "toolbox/ident/ident/"; + "aboutsignaltbx" , "toolbox/signal/signal/"; + "absdata" , "toolbox/simulink/simdemos/automotive/"; + "ac2poly" , "toolbox/signal/signal/"; + "ac2rc" , "toolbox/signal/signal/"; + "accdemo" , "toolbox/robust/"; + "accdm2" , "toolbox/robust/"; + "acceva" , "toolbox/robust/"; + "acceva2" , "toolbox/robust/"; + "accplt" , "toolbox/robust/"; + "accroot" , "toolbox/robust/"; + "acker" , "toolbox/control/control/"; + "acquire_print_portal" , "toolbox/stateflow/stateflow/private/"; + "acquire_target" , "toolbox/stateflow/stateflow/private/"; + "actdemo" , "toolbox/robust/"; + "actual_machine_referred_by" , "toolbox/stateflow/stateflow/private/"; + "adams" , "toolbox/simulink/simulink/"; + "adapthisteq" , "toolbox/images/images/"; + "adaptmesh" , "toolbox/pde/"; + "add_block" , "toolbox/simulink/simulink/"; + "add_engine_event_listener" , "toolbox/simulink/simulink/"; + "add_exec_event_listener" , "toolbox/simulink/simulink/"; + "add_line" , "toolbox/simulink/simulink/"; + "add_param" , "toolbox/simulink/simulink/"; + "addbisa" , "toolbox/stats/private/"; + "addcomponents" , "toolbox/signal/sigtools/private/"; + "addcsmenu" , "toolbox/signal/sigtools/"; + "adddynprop" , "toolbox/signal/sigtools/"; + "addedvarplot" , "toolbox/stats/"; + "addfreqcsmenu" , "toolbox/signal/sigtools/"; + "addinvg" , "toolbox/stats/private/"; + "addlogi" , "toolbox/stats/private/"; + "addmenu" , "toolbox/signal/sigtools/"; + "addnaka" , "toolbox/stats/private/"; + "addnk" , "toolbox/ident/idutils/"; + "addoptask" , "toolbox/shared/slcontrollib/"; + "addoutputspec" , "toolbox/shared/slcontrollib/"; + "addplugins" , "toolbox/signal/sigtools/"; + "addprops" , "toolbox/signal/sigtools/"; + "addrice" , "toolbox/stats/private/"; + "addss" , "toolbox/robust/"; + "addterms" , "toolbox/simulink/simulink/"; + "addtimecsmenu" , "toolbox/signal/sigtools/"; + "addtls" , "toolbox/stats/private/"; + "addtoolbarbtn" , "toolbox/signal/sigtools/"; + "addunitsmenu" , "toolbox/signal/sigtools/"; + "adesc" , "toolbox/signal/signal/private/"; + "aebalance" , "toolbox/control/ctrlutil/"; + "aero_atc_callback" , "toolbox/simulink/simdemos/aerospace/"; + "aero_atcgui" , "toolbox/simulink/simdemos/aerospace/"; + "aero_atcscript" , "toolbox/simulink/simdemos/aerospace/"; + "aero_dap3dofdata" , "toolbox/simulink/simdemos/aerospace/"; + "aero_extkalman" , "toolbox/simulink/simdemos/aerospace/"; + "aero_guid_dat" , "toolbox/simulink/simdemos/aerospace/"; + "aero_guid_plot" , "toolbox/simulink/simdemos/aerospace/"; + "aero_guidancedemoscript" , "toolbox/simulink/simdemos/aerospace/"; + "aero_init_atc" , "toolbox/simulink/simdemos/aerospace/"; + "aero_lin_aero" , "toolbox/simulink/simdemos/aerospace/"; + "aero_phaseplane" , "toolbox/simulink/simdemos/aerospace/"; + "aero_pointer_tracker" , "toolbox/simulink/simdemos/aerospace/"; + "aero_preload_atc" , "toolbox/simulink/simdemos/aerospace/"; + "aero_raddat" , "toolbox/simulink/simdemos/aerospace/"; + "aero_radplot" , "toolbox/simulink/simdemos/aerospace/"; + "aliastypeddg" , "toolbox/simulink/simulink/"; + "allpass" , "toolbox/signal/signal/private/"; + "analysistags" , "toolbox/signal/sigtools/private/"; + "andrewsplot" , "toolbox/stats/"; + "animinit" , "toolbox/simulink/simdemos/simgeneral/"; + "anova1" , "toolbox/stats/"; + "anova2" , "toolbox/stats/"; + "anovan" , "toolbox/stats/"; + "aoctool" , "toolbox/stats/"; + "append" , "toolbox/control/control/"; + "applyabsolute" , "toolbox/images/images/private/"; + "applycform" , "toolbox/images/images/"; + "applycformsequence" , "toolbox/images/images/private/"; + "applyclut" , "toolbox/images/images/private/"; + "applyfilt" , "toolbox/signal/sptoolgui/private/"; + "applyiccsequence" , "toolbox/images/images/private/"; + "applylut" , "toolbox/images/images/"; + "applymattrc_fwd" , "toolbox/images/images/private/"; + "applymattrc_inv" , "toolbox/images/images/private/"; + "appstr" , "toolbox/signal/sptoolgui/private/"; + "aprecon" , "toolbox/optim/"; + "aptknt" , "toolbox/splines/"; + "ar" , "toolbox/ident/ident/"; + "arburg" , "toolbox/signal/signal/"; + "arcov" , "toolbox/signal/signal/"; + "are" , "toolbox/control/ctrlobsolete/"; + "arecheckin" , "toolbox/control/control/private/"; + "arecheckout" , "toolbox/control/control/private/"; + "arefact2x" , "toolbox/control/control/private/"; + "arescale" , "toolbox/control/control/private/"; + "aresolv" , "toolbox/robust/"; + "armax" , "toolbox/ident/ident/"; + "armcov" , "toolbox/signal/signal/"; + "arparest" , "toolbox/signal/signal/private/"; + "arspectra" , "toolbox/signal/signal/private/"; + "arx" , "toolbox/ident/ident/"; + "arx2th" , "toolbox/ident/idobsolete/"; + "arx_f" , "toolbox/ident/ident/"; + "arxdecod" , "toolbox/ident/idutils/"; + "arxstruc" , "toolbox/ident/ident/"; + "aryule" , "toolbox/signal/signal/"; + "assema" , "toolbox/pde/"; + "assemb" , "toolbox/pde/"; + "assempde" , "toolbox/pde/"; + "assignline" , "toolbox/signal/sptoolgui/private/"; + "asys2ss" , "toolbox/robust/"; + "atamult" , "toolbox/optim/private/"; + "attachConfigSet" , "toolbox/simulink/simulink/"; + "augact" , "toolbox/robust/"; + "augd" , "toolbox/robust/"; + "augknt" , "toolbox/splines/"; + "augment" , "toolbox/robust/"; + "augss" , "toolbox/robust/"; + "augstate" , "toolbox/control/control/"; + "augtf" , "toolbox/robust/"; + "autobuild" , "toolbox/stateflow/stateflow/private/"; + "autobuild_driver" , "toolbox/stateflow/stateflow/private/"; + "autobuild_kernel" , "toolbox/stateflow/stateflow/private/"; + "autoline" , "toolbox/simulink/simulink/"; + "autopilotdemo" , "toolbox/simulink/simdemos/aerospace/"; + "auxvar" , "toolbox/ident/idobsolete/"; + "aveknt" , "toolbox/splines/"; + "axes2pix" , "toolbox/images/images/private/"; + "baldemo" , "toolbox/robust/"; + "balmr" , "toolbox/robust/"; + "balreal" , "toolbox/control/control/"; + "balsq" , "toolbox/robust/"; + "bandem" , "toolbox/optim/"; + "bandpass" , "toolbox/signal/signal/private/"; + "bandstop" , "toolbox/signal/signal/private/"; + "barplotm" , "toolbox/simulink/blocks/"; + "barthannwin" , "toolbox/signal/signal/"; + "bartlett" , "toolbox/signal/signal/"; + "barttest" , "toolbox/stats/"; + "bbdesign" , "toolbox/stats/"; + "bdclose" , "toolbox/simulink/simulink/"; + "bdroot" , "toolbox/simulink/simulink/"; + "bdschur" , "toolbox/control/ctrlutil/"; + "ben2adat" , "toolbox/simulink/simdemos/"; + "ben2bdat" , "toolbox/simulink/simdemos/"; + "ben2cdat" , "toolbox/simulink/simdemos/"; + "ben3adat" , "toolbox/simulink/simdemos/"; + "ben3bdat" , "toolbox/simulink/simdemos/"; + "besselap" , "toolbox/signal/signal/"; + "besself" , "toolbox/signal/signal/"; + "bestblk" , "toolbox/images/images/"; + "bestfixexp" , "toolbox/simulink/fixedandfloat/"; + "betacdf" , "toolbox/stats/"; + "betafit" , "toolbox/stats/"; + "betainv" , "toolbox/stats/"; + "betalik1" , "toolbox/stats/"; + "betalike" , "toolbox/stats/"; + "betapdf" , "toolbox/stats/"; + "betarnd" , "toolbox/stats/"; + "betastat" , "toolbox/stats/"; + "bhrdemo" , "toolbox/robust/"; + "bilexp" , "toolbox/robust/"; + "bilin" , "toolbox/robust/"; + "bilinear" , "toolbox/signal/signal/"; + "binocdf" , "toolbox/stats/"; + "binofit" , "toolbox/stats/"; + "binoinv" , "toolbox/stats/"; + "binopdf" , "toolbox/stats/"; + "binornd" , "toolbox/stats/"; + "binostat" , "toolbox/stats/"; + "bintprog" , "toolbox/optim/"; + "biplot" , "toolbox/stats/"; + "biqpbox" , "toolbox/optim/private/"; + "bitrevorder" , "toolbox/signal/signal/"; + "bj" , "toolbox/ident/ident/"; + "bkbrk" , "toolbox/splines/"; + "blackman" , "toolbox/signal/signal/"; + "blackmanharris" , "toolbox/signal/signal/"; + "blkbuild" , "toolbox/control/ctrlobsolete/"; + "blkout2sfunout" , "toolbox/stateflow/stateflow/private/"; + "blkproc" , "toolbox/images/images/"; + "blkrsch" , "toolbox/robust/"; + "blkxchk" , "toolbox/simulink/simulink/private/"; + "block2chart" , "toolbox/stateflow/stateflow/private/"; + "block2link" , "toolbox/simulink/components/private/"; + "blockGetDialogSchema" , "toolbox/shared/dastudio/"; + "blockconnect" , "toolbox/slcontrol/slctrlutil/"; + "blowfish" , "toolbox/stateflow/stateflow/private/"; + "bode" , "toolbox/control/control/"; + "bodeaux" , "toolbox/ident/idutils/"; + "bodeplot" , "toolbox/ident/idobsolete/"; + "bohmanwin" , "toolbox/signal/signal/"; + "boolean" , "toolbox/simulink/simulink/"; + "bootstrp" , "toolbox/stats/"; + "boxcar" , "toolbox/signal/signal/"; + "boxplot" , "toolbox/stats/"; + "boxutil" , "toolbox/stats/"; + "branch" , "toolbox/robust/"; + "brk2knt" , "toolbox/splines/"; + "brownfg" , "toolbox/optim/"; + "brownfgh" , "toolbox/optim/"; + "brownvv" , "toolbox/optim/"; + "bscost" , "toolbox/signal/signal/"; + "bsplidem" , "toolbox/splines/"; + "bspligui" , "toolbox/splines/"; + "bspline" , "toolbox/splines/"; + "bstschml" , "toolbox/robust/"; + "bstschmr" , "toolbox/robust/"; + "buffer" , "toolbox/signal/signal/"; + "build_model_reference_target" , "toolbox/simulink/simulink/private/"; + "build_sl_hierarchy" , "toolbox/simulink/simcoverage/private/"; + "build_standalone_rtw_target" , "toolbox/simulink/simulink/private/"; + "build_target" , "toolbox/simulink/simulink/private/"; + "busAssignmentddg" , "toolbox/simulink/blocks/"; + "busCreatorddg" , "toolbox/simulink/blocks/"; + "busCreatorddg_cb" , "toolbox/simulink/simulink/"; + "busSelectorddg" , "toolbox/simulink/blocks/"; + "buscreator" , "toolbox/simulink/simulink/"; + "busddg" , "toolbox/simulink/simulink/"; + "busdemoscript" , "toolbox/simulink/simdemos/simfeatures/"; + "buseditor" , "toolbox/simulink/simulink/"; + "buselementddg" , "toolbox/simulink/simulink/"; + "busselect" , "toolbox/simulink/simulink/"; + "buttap" , "toolbox/signal/signal/"; + "butter" , "toolbox/signal/signal/"; + "buttord" , "toolbox/signal/signal/"; + "bwarea" , "toolbox/images/images/"; + "bwareaopen" , "toolbox/images/images/"; + "bwboundaries" , "toolbox/images/images/"; + "bwdist" , "toolbox/images/images/"; + "bweuler" , "toolbox/images/images/"; + "bwfill" , "toolbox/images/images/"; + "bwhitmiss" , "toolbox/images/images/"; + "bwlabel" , "toolbox/images/images/"; + "bwlabeln" , "toolbox/images/images/"; + "bwmorph" , "toolbox/images/images/"; + "bwpack" , "toolbox/images/images/"; + "bwperim" , "toolbox/images/images/"; + "bwselect" , "toolbox/images/images/"; + "bwtraceboundary" , "toolbox/images/images/"; + "bwulterode" , "toolbox/images/images/"; + "bwunpack" , "toolbox/images/images/"; + "c2d" , "toolbox/simulink/simulink/private/"; + "c2d" , "toolbox/control/control/"; + "c2dm" , "toolbox/control/ctrlobsolete/"; + "c2dt" , "toolbox/control/ctrlobsolete/"; + "c_indent" , "toolbox/rtw/rtw/"; + "c_type_from_sf_type" , "toolbox/stateflow/coder/private/"; + "callback_function_management" , "toolbox/rtw/rtw/"; + "callperl" , "toolbox/simulink/simulink/"; + "candexch" , "toolbox/stats/"; + "candgen" , "toolbox/stats/"; + "canform" , "toolbox/ident/idobsolete/"; + "canon" , "toolbox/control/control/"; + "canoncorr" , "toolbox/stats/"; + "canstart" , "toolbox/ident/idobsolete/"; + "capable" , "toolbox/stats/"; + "capacitor" , "toolbox/control/ctrldemos/private/"; + "capaplot" , "toolbox/stats/"; + "cardb" , "toolbox/pde/"; + "cardg" , "toolbox/pde/"; + "care" , "toolbox/control/control/"; + "caseread" , "toolbox/stats/"; + "casewrite" , "toolbox/stats/"; + "cast" , "toolbox/images/images/private/"; + "cccopyfcn" , "toolbox/rtw/rtw/"; + "ccdesign" , "toolbox/stats/"; + "cceps" , "toolbox/signal/signal/"; + "ccopenfcn" , "toolbox/rtw/rtw/"; + "cdf" , "toolbox/stats/"; + "cdfcalc" , "toolbox/stats/"; + "cdfplot" , "toolbox/stats/"; + "cedit" , "toolbox/local/"; + "cell2sos" , "toolbox/signal/signal/"; + "cellengunits" , "toolbox/signal/sigtools/"; + "centerfig" , "toolbox/shared/controllib/"; + "centerfigonfig" , "toolbox/signal/sigtools/private/"; + "cfgDlgCBRedirect" , "toolbox/simulink/simulink/private/"; + "cfirpm" , "toolbox/signal/signal/"; + "cftoolchecknames" , "toolbox/images/images/private/"; + "cgloci" , "toolbox/robust/"; + "cgloci2" , "toolbox/robust/"; + "changeBoundDualFeasible" , "toolbox/optim/private/"; + "changeBoundLP" , "toolbox/optim/private/"; + "changeSimPrmTab" , "toolbox/simulink/simulink/"; + "change_de_port_index" , "toolbox/stateflow/stateflow/private/"; + "change_icon_to" , "toolbox/stateflow/stateflow/private/"; + "changeclass" , "toolbox/images/images/private/"; + "changedisplay" , "toolbox/signal/sigtools/"; + "chanupd" , "toolbox/ident/idguis/"; + "chaos2das" , "toolbox/shared/dastudio/"; + "chart2block" , "toolbox/stateflow/stateflow/private/"; + "chart2name" , "toolbox/stateflow/stateflow/private/"; + "chart_real_transitions" , "toolbox/stateflow/stateflow/private/"; + "chart_recovery_man" , "toolbox/stateflow/stateflow/private/"; + "chartddg" , "toolbox/stateflow/stateflow/private/"; + "chartdlg" , "toolbox/stateflow/stateflow/private/"; + "chbpnt" , "toolbox/splines/"; + "chckxywp" , "toolbox/splines/"; + "cheb1ap" , "toolbox/signal/signal/"; + "cheb1ord" , "toolbox/signal/signal/"; + "cheb2ap" , "toolbox/signal/signal/"; + "cheb2ord" , "toolbox/signal/signal/"; + "chebdem" , "toolbox/splines/"; + "chebloop" , "toolbox/splines/"; + "chebwin" , "toolbox/signal/signal/"; + "cheby1" , "toolbox/signal/signal/"; + "cheby2" , "toolbox/signal/signal/"; + "checkSimPrm" , "toolbox/simulink/simulink/private/"; + "check_bang_in_dir" , "toolbox/stateflow/stateflow/private/"; + "check_fan_params" , "toolbox/images/images/private/"; + "check_for_long_model_name" , "toolbox/stateflow/stateflow/private/"; + "check_if_file_is_in_sync" , "toolbox/stateflow/stateflow/private/"; + "check_mdl_precedence" , "toolbox/simulink/simulink/"; + "check_order" , "toolbox/signal/signal/private/"; + "checkbounds" , "toolbox/shared/optimlib/"; + "checkconn" , "toolbox/images/images/private/"; + "checkerboard" , "toolbox/images/images/"; + "checkinput" , "toolbox/images/images/private/"; + "checkinputsigdim" , "toolbox/signal/sigtools/"; + "checkmap" , "toolbox/images/images/private/"; + "checknargin" , "toolbox/images/images/private/"; + "checkstrs" , "toolbox/images/images/private/"; + "chi2cdf" , "toolbox/stats/"; + "chi2conf" , "toolbox/signal/signal/private/"; + "chi2inv" , "toolbox/stats/"; + "chi2pdf" , "toolbox/stats/"; + "chi2rnd" , "toolbox/stats/"; + "chi2stat" , "toolbox/stats/"; + "chirp" , "toolbox/signal/signal/"; + "chk_license" , "toolbox/simulink/simdemos/automotive/"; + "chkmdinteg" , "toolbox/ident/idutils/"; + "chkrules" , "toolbox/simulink/components/private/"; + "chop" , "toolbox/control/ctrlobsolete/"; + "circleb1" , "toolbox/pde/"; + "circleb2" , "toolbox/pde/"; + "circlef" , "toolbox/pde/"; + "circleg" , "toolbox/pde/"; + "circlepick" , "toolbox/pde/"; + "circustent" , "toolbox/optim/"; + "cirsb" , "toolbox/pde/"; + "cirsg" , "toolbox/pde/"; + "classdemo" , "toolbox/stats/"; + "classify" , "toolbox/stats/"; + "clean_code_gen_dir" , "toolbox/stateflow/coder/private/"; + "clean_error_msg" , "toolbox/stateflow/stateflow/private/"; + "clean_target" , "toolbox/stateflow/stateflow/private/"; + "cleanerrormsg" , "toolbox/signal/sigtools/"; + "clipdivide" , "toolbox/images/images/private/"; + "cloop" , "toolbox/control/ctrlobsolete/"; + "close_models" , "toolbox/simulink/simulink/private/"; + "close_system" , "toolbox/simulink/simulink/"; + "closemachines" , "toolbox/stateflow/stateflow/private/"; + "cluster" , "toolbox/stats/"; + "clusterdata" , "toolbox/stats/"; + "clusterdemo" , "toolbox/stats/"; + "clutchplot" , "toolbox/simulink/simdemos/automotive/"; + "clutchplot_if" , "toolbox/simulink/simdemos/automotive/"; + "clxbode" , "toolbox/robust/"; + "cmd_window_buffering" , "toolbox/rtw/rtw/"; + "cmdscale" , "toolbox/stats/"; + "cmdscaledemo" , "toolbox/stats/"; + "cmgamdef" , "toolbox/images/images/"; + "cmgamma" , "toolbox/images/images/"; + "cminfo" , "toolbox/local/"; + "cmopts" , "toolbox/local/"; + "cmpermute" , "toolbox/images/images/"; + "cmunique" , "toolbox/images/images/"; + "code_borland_make_file" , "toolbox/stateflow/coder/private/"; + "code_chart_debug_initialization" , "toolbox/stateflow/coder/private/"; + "code_chart_header_file" , "toolbox/stateflow/coder/private/"; + "code_chart_header_file__rtw" , "toolbox/stateflow/coder/private/"; + "code_chart_header_file_custom" , "toolbox/stateflow/coder/private/"; + "code_chart_header_file_sfun" , "toolbox/stateflow/coder/private/"; + "code_chart_source_file" , "toolbox/stateflow/coder/private/"; + "code_chart_source_file_custom" , "toolbox/stateflow/coder/private/"; + "code_chart_source_file_rtw" , "toolbox/stateflow/coder/private/"; + "code_chart_source_file_sfun" , "toolbox/stateflow/coder/private/"; + "code_data_initialization" , "toolbox/stateflow/coder/private/"; + "code_debug_macros" , "toolbox/stateflow/coder/private/"; + "code_interface_and_support_files" , "toolbox/stateflow/coder/private/"; + "code_lcc_make_file" , "toolbox/stateflow/coder/private/"; + "code_machine_debug_initialization" , "toolbox/stateflow/coder/private/"; + "code_machine_def_file" , "toolbox/stateflow/coder/private/"; + "code_machine_header_file" , "toolbox/stateflow/coder/private/"; + "code_machine_header_file_custom" , "toolbox/stateflow/coder/private/"; + "code_machine_header_file_rtw" , "toolbox/stateflow/coder/private/"; + "code_machine_header_file_sfun" , "toolbox/stateflow/coder/private/"; + "code_machine_objlist_file" , "toolbox/stateflow/coder/private/"; + "code_machine_registry_file" , "toolbox/stateflow/coder/private/"; + "code_machine_source_file" , "toolbox/stateflow/coder/private/"; + "code_machine_source_file_custom" , "toolbox/stateflow/coder/private/"; + "code_machine_source_file_rtw" , "toolbox/stateflow/coder/private/"; + "code_machine_source_file_sfun" , "toolbox/stateflow/coder/private/"; + "code_msvc50_dswfile" , "toolbox/stateflow/coder/private/"; + "code_msvc50_makefile" , "toolbox/stateflow/coder/private/"; + "code_msvc_make_file" , "toolbox/stateflow/coder/private/"; + "code_sfun_glue_code" , "toolbox/stateflow/coder/private/"; + "code_unix_make_file" , "toolbox/stateflow/coder/private/"; + "code_watcom_make_file" , "toolbox/stateflow/coder/private/"; + "coder_error_count_man" , "toolbox/stateflow/stateflow/private/"; + "coder_options" , "toolbox/stateflow/coder/private/"; + "coder_opts_ddg" , "toolbox/stateflow/stateflow/private/"; + "coder_opts_ddg_preapply_cb" , "toolbox/stateflow/stateflow/private/"; + "cohere" , "toolbox/signal/signal/"; + "col2im" , "toolbox/images/images/"; + "colfilt" , "toolbox/images/images/"; + "collatetranslations" , "toolbox/simulink/simulink/"; + "collect_custom_code_symbols" , "toolbox/stateflow/stateflow/private/"; + "color" , "toolbox/optim/"; + "color2background" , "toolbox/signal/sigtools/"; + "combnk" , "toolbox/stats/"; + "comclient" , "toolbox/local/"; + "compare_components" , "toolbox/simulink/simulink/private/"; + "compare_configuration_sets" , "toolbox/simulink/simulink/private/"; + "compat13" , "toolbox/simulink/simulink/private/"; + "compdir" , "toolbox/shared/optimlib/"; + "compilerman" , "toolbox/stateflow/stateflow/private/"; + "completefreqresp" , "toolbox/signal/signal/"; + "compreal" , "toolbox/control/ctrlutil/"; + "compute_chart_information" , "toolbox/stateflow/coder/private/"; + "compute_compiler_info" , "toolbox/stateflow/coder/private/"; + "compute_event_enum_values" , "toolbox/stateflow/coder/private/"; + "compute_inc_codegen_info" , "toolbox/stateflow/coder/private/"; + "compute_machine_info" , "toolbox/stateflow/coder/private/"; + "compute_rtw_multi_instance_info" , "toolbox/stateflow/coder/private/"; + "compute_sfun_io_port_info" , "toolbox/stateflow/coder/private/"; + "compute_state_enums" , "toolbox/stateflow/coder/private/"; + "compute_target_info" , "toolbox/stateflow/coder/private/"; + "compute_value_from_rtwoptions" , "toolbox/rtw/rtw/"; + "computeperiodogram" , "toolbox/signal/signal/private/"; + "computepsd" , "toolbox/signal/signal/"; + "configDlgAction" , "toolbox/simulink/simulink/private/"; + "configDlgCallback" , "toolbox/simulink/simulink/private/"; + "configHelp" , "toolbox/simulink/simulink/private/"; + "configSetPref" , "toolbox/simulink/simulink/private/"; + "config_dlg_configure_param" , "toolbox/simulink/simulink/"; + "configblk" , "toolbox/simulink/simulink/"; + "configset_delete" , "toolbox/simulink/simulink/private/"; + "configure_model_reference_target_status" , "toolbox/simulink/simulink/private/"; + "confun" , "toolbox/optim/"; + "confuneq" , "toolbox/optim/"; + "confungrad" , "toolbox/optim/"; + "conn2array" , "toolbox/images/images/private/"; + "conndef" , "toolbox/images/images/"; + "connect" , "toolbox/control/control/"; + "connectline" , "toolbox/control/ctrlutil/"; + "construct_coder_error" , "toolbox/stateflow/coder/private/"; + "construct_context_for_machine" , "toolbox/stateflow/coder/private/"; + "construct_error" , "toolbox/stateflow/stateflow/private/"; + "construct_module" , "toolbox/stateflow/coder/private/"; + "construct_tt_error" , "toolbox/stateflow/stateflow/private/"; + "construct_warning" , "toolbox/stateflow/stateflow/private/"; + "convert2db" , "toolbox/signal/sigtools/"; + "convert2deg" , "toolbox/signal/sigtools/"; + "convert2engstrs" , "toolbox/signal/sigtools/"; + "convert2sq" , "toolbox/signal/sigtools/"; + "convert2vector" , "toolbox/signal/sigtools/"; + "convertSampleTimeInfo" , "toolbox/simulink/simulink/private/"; + "convertfrequnits" , "toolbox/signal/sigtools/"; + "convertmagunits" , "toolbox/signal/sigtools/"; + "convhullx" , "toolbox/images/images/private/"; + "convmtx" , "toolbox/signal/signal/"; + "convmtx2" , "toolbox/images/images/"; + "cophenet" , "toolbox/stats/"; + "copulademo" , "toolbox/stats/"; + "copy_object_properties" , "toolbox/simulink/simulink/"; + "copy_target_props" , "toolbox/stateflow/stateflow/private/"; + "cordexch" , "toolbox/stats/"; + "corelucy" , "toolbox/images/images/private/"; + "corr" , "toolbox/stats/"; + "corr2" , "toolbox/images/images/"; + "corrmtx" , "toolbox/signal/signal/"; + "cosint" , "toolbox/symbolic/"; + "count_fixpt_blks" , "toolbox/simulink/fixedandfloat/"; + "covar" , "toolbox/control/control/"; + "covf" , "toolbox/ident/idobsolete/"; + "covf2" , "toolbox/ident/idobsolete/"; + "covlamb" , "toolbox/ident/idutils/"; + "cp2tform" , "toolbox/images/images/"; + "cpcorr" , "toolbox/images/images/"; + "cppredict" , "toolbox/images/images/private/"; + "cpsave" , "toolbox/images/images/private/"; + "cpsd" , "toolbox/signal/signal/"; + "cpselect" , "toolbox/images/images/"; + "cpselecthelp" , "toolbox/images/images/private/"; + "cpstruct2pairs" , "toolbox/images/images/"; + "cr" , "toolbox/simulink/simulink/private/"; + "cra" , "toolbox/ident/ident/"; + "crackb" , "toolbox/pde/"; + "crackg" , "toolbox/pde/"; + "createDASimulink" , "toolbox/shared/dastudio/"; + "create_directory_path" , "toolbox/stateflow/stateflow/private/"; + "create_file_name_info" , "toolbox/stateflow/coder/private/"; + "create_nag" , "toolbox/simulink/simulink/private/"; + "create_truth_table" , "toolbox/stateflow/stateflow/private/"; + "createfigcopy" , "toolbox/signal/sigtools/private/"; + "createsignalzoom" , "toolbox/signal/sigtools/"; + "createtdtlisteners" , "toolbox/simulink/simulink/"; + "cremez" , "toolbox/signal/signal/"; + "crmz" , "toolbox/signal/signal/private/"; + "crosstab" , "toolbox/stats/"; + "crtanim1" , "toolbox/simulink/simdemos/simgeneral/"; + "crtanim2" , "toolbox/simulink/simdemos/simgeneral/"; + "cs" , "toolbox/ident/iddemos/"; + "cs1" , "toolbox/ident/iddemos/"; + "cs2" , "toolbox/ident/iddemos/"; + "csape" , "toolbox/splines/"; + "csapi" , "toolbox/splines/"; + "csapidem" , "toolbox/splines/"; + "csaps" , "toolbox/splines/"; + "csapsdem" , "toolbox/splines/"; + "cschur" , "toolbox/robust/"; + "cscvn" , "toolbox/splines/"; + "csd" , "toolbox/signal/signal/"; + "csfunc" , "toolbox/simulink/blocks/"; + "csgchk" , "toolbox/pde/"; + "csgdel" , "toolbox/pde/"; + "cshelpcontextmenu" , "toolbox/signal/sigtools/"; + "cshelpengine" , "toolbox/signal/sigtools/"; + "cshelpgeneral_cb" , "toolbox/signal/sigtools/"; + "cspecchk" , "toolbox/images/images/private/"; + "cstdefs" , "toolbox/control/ctrlguis/"; + "cstupdate" , "toolbox/control/ctrlguis/"; + "ctrb" , "toolbox/control/control/"; + "ctrbf" , "toolbox/control/control/"; + "ctrlguihelp" , "toolbox/control/ctrlguis/"; + "ctrlpref" , "toolbox/control/control/"; + "ctx_add_note" , "toolbox/stateflow/stateflow/private/"; + "ctx_toggle_smart" , "toolbox/stateflow/stateflow/private/"; + "ctxmenuman" , "toolbox/stateflow/stateflow/private/"; + "cubic" , "toolbox/optim/"; + "cubici1" , "toolbox/optim/"; + "cubici2" , "toolbox/optim/"; + "cubici3" , "toolbox/optim/"; + "currentchart" , "toolbox/stateflow/stateflow/private/"; + "custcodehelp" , "toolbox/rtw/rtw/"; + "customdist1demo" , "toolbox/stats/"; + "customdist2demo" , "toolbox/stats/"; + "cv_append_autoscale_data" , "toolbox/simulink/simcoverage/private/"; + "cv_dialog_options" , "toolbox/simulink/simcoverage/private/"; + "cv_init_dialog_test" , "toolbox/simulink/simcoverage/private/"; + "cv_is_model_autoscale" , "toolbox/simulink/simcoverage/private/"; + "cv_metric_names" , "toolbox/simulink/simcoverage/private/"; + "cv_model_enabled" , "toolbox/simulink/simcoverage/private/"; + "cv_sf_chart_data" , "toolbox/simulink/simcoverage/private/"; + "cv_term_dialog_test" , "toolbox/simulink/simcoverage/private/"; + "cvinit" , "toolbox/simulink/simcoverage/private/"; + "cvmodel" , "toolbox/simulink/simcoverage/private/"; + "cvsf" , "toolbox/simulink/simcoverage/private/"; + "cycle_error_help" , "toolbox/stateflow/stateflow/private/"; + "czt" , "toolbox/signal/signal/"; + "cztdemo" , "toolbox/signal/sigdemos/"; + "d2c" , "toolbox/control/control/"; + "d2ci" , "toolbox/simulink/simulink/private/"; + "d2cm" , "toolbox/control/ctrlobsolete/"; + "d2d" , "toolbox/control/control/"; + "d2d" , "toolbox/simulink/simulink/private/"; + "da_mxarray_get_schema" , "toolbox/shared/dastudio/"; + "daabout" , "toolbox/shared/dastudio/"; + "dactdemo" , "toolbox/robust/"; + "daexplr" , "toolbox/shared/dastudio/"; + "damp" , "toolbox/control/control/"; + "damp" , "toolbox/ident/idutils/private/"; + "dare" , "toolbox/control/control/"; + "daresolv" , "toolbox/robust/"; + "das2chaos" , "toolbox/shared/dastudio/"; + "das_dv_hyperlink" , "toolbox/shared/dastudio/"; + "das_get_data_type" , "toolbox/shared/dastudio/"; + "das_get_enum_values" , "toolbox/shared/dastudio/"; + "das_undo_gateway" , "toolbox/shared/dastudio/"; + "das_undo_stack" , "toolbox/shared/dastudio/"; + "dataStoreMemddg" , "toolbox/simulink/blocks/"; + "dataStoreRWddg" , "toolbox/simulink/blocks/"; + "dataStoreRWddg_cb" , "toolbox/simulink/simulink/"; + "dataddg" , "toolbox/simulink/simulink/"; + "dataddg" , "toolbox/stateflow/stateflow/private/"; + "dataddg_cb" , "toolbox/simulink/simulink/"; + "dataddg_mxarray" , "toolbox/shared/dastudio/"; + "dataddg_port_callback" , "toolbox/stateflow/stateflow/private/"; + "dataddg_preapply_callback" , "toolbox/stateflow/stateflow/private/"; + "dataddg_preclose_callback" , "toolbox/stateflow/stateflow/private/"; + "datadlg" , "toolbox/stateflow/stateflow/private/"; + "datatip" , "toolbox/control/ctrlobsolete/"; + "datawrap" , "toolbox/signal/signal/"; + "datdemo" , "toolbox/optim/"; + "daugment" , "toolbox/stats/"; + "db" , "toolbox/signal/signal/"; + "dbalreal" , "toolbox/control/ctrlobsolete/"; + "dbm" , "toolbox/signal/signal/private/"; + "dbode" , "toolbox/control/ctrlobsolete/"; + "dcdemo" , "toolbox/control/ctrldemos/"; + "dcgain" , "toolbox/control/control/"; + "dcgloci" , "toolbox/robust/"; + "dcgloci2" , "toolbox/robust/"; + "dclxbode" , "toolbox/robust/"; + "dcovar" , "toolbox/control/ctrlobsolete/"; + "dcovary" , "toolbox/stats/"; + "dct" , "toolbox/images/images/private/"; + "dct" , "toolbox/signal/signal/"; + "dct2" , "toolbox/images/images/"; + "dctdemo" , "toolbox/images/imdemos/"; + "dctmtx" , "toolbox/images/images/"; + "dctmtx2" , "toolbox/images/images/"; + "dctold" , "toolbox/signal/signal/private/"; + "ddamp" , "toolbox/control/ctrlobsolete/"; + "ddcgain" , "toolbox/control/ctrlobsolete/"; + "ddg_get_parent_name" , "toolbox/stateflow/stateflow/private/"; + "ddist" , "toolbox/images/images/private/"; + "deblankall" , "toolbox/simulink/simulink/private/"; + "debugdlg" , "toolbox/stateflow/stateflow/private/"; + "decimate" , "toolbox/signal/signal/"; + "deconvblind" , "toolbox/images/images/"; + "deconvlucy" , "toolbox/images/images/"; + "deconvreg" , "toolbox/images/images/"; + "deconvwnr" , "toolbox/images/images/"; + "decorrstretch" , "toolbox/images/images/"; + "decrypt_machine" , "toolbox/stateflow/stateflow/private/"; + "decsg" , "toolbox/pde/"; + "dee4plt" , "toolbox/simulink/dee/"; + "dee4plti" , "toolbox/simulink/dee/"; + "deechgnm" , "toolbox/simulink/dee/"; + "deedemi4" , "toolbox/simulink/dee/"; + "deeflag" , "toolbox/simulink/dee/"; + "deehelp" , "toolbox/simulink/dee/"; + "deelin" , "toolbox/simulink/dee/"; + "deerestr" , "toolbox/simulink/dee/"; + "deeupdat" , "toolbox/simulink/dee/"; + "default_target_methods" , "toolbox/stateflow/stateflow/private/"; + "defaultlutblklist" , "toolbox/simulink/blocks/private/"; + "definev" , "toolbox/optim/private/"; + "defnum" , "toolbox/ident/idutils/"; + "defnum2" , "toolbox/ident/idutils/"; + "defnum3" , "toolbox/ident/idutils/"; + "delayest" , "toolbox/ident/ident/"; + "delayfr" , "toolbox/control/ctrlutil/"; + "delete_block" , "toolbox/simulink/simulink/"; + "delete_line" , "toolbox/simulink/simulink/"; + "delete_param" , "toolbox/simulink/simulink/"; + "deletehgfig" , "toolbox/simulink/simulink/"; + "democlean" , "toolbox/control/ctrldemos/private/"; + "demod" , "toolbox/signal/signal/"; + "dendrogram" , "toolbox/stats/"; + "dep" , "toolbox/optim/private/"; + "des2ss" , "toolbox/robust/"; + "despace" , "toolbox/stateflow/stateflow/private/"; + "destim" , "toolbox/control/ctrlobsolete/"; + "detachConfigSet" , "toolbox/simulink/simulink/"; + "deterministicsignalpower" , "toolbox/signal/sigdemos/"; + "dexresp" , "toolbox/control/ctrlobsolete/"; + "dfaddbuttons" , "toolbox/stats/private/"; + "dfaddparamfit" , "toolbox/stats/private/"; + "dfaddsmoothfit" , "toolbox/stats/private/"; + "dfadjustlayout" , "toolbox/stats/private/"; + "dfadjustmenu" , "toolbox/stats/private/"; + "dfadjusttoolbar" , "toolbox/stats/private/"; + "dfasksavesession" , "toolbox/stats/private/"; + "dfaxlimctrl" , "toolbox/stats/private/"; + "dfbinwidthpreview" , "toolbox/stats/private/"; + "dfboundwarn" , "toolbox/stats/private/"; + "dfcanplotdata" , "toolbox/stats/private/"; + "dfcbkclear" , "toolbox/stats/private/"; + "dfcheckselections" , "toolbox/stats/private/"; + "dfcopyexrule" , "toolbox/stats/private/"; + "dfcreatecopy" , "toolbox/stats/private/"; + "dfcreatedataset" , "toolbox/stats/private/"; + "dfcreateexclusionrule" , "toolbox/stats/private/"; + "dfcreateplot" , "toolbox/stats/private/"; + "dfcustomdist" , "toolbox/stats/private/"; + "dfdeleteexrule" , "toolbox/stats/private/"; + "dfdelgraphexclude" , "toolbox/stats/private/"; + "dfdocontext" , "toolbox/stats/private/"; + "dfdupfigure" , "toolbox/stats/private/"; + "dfevaluate" , "toolbox/stats/private/"; + "dfevaluateplot" , "toolbox/stats/private/"; + "dfexport2workspace" , "toolbox/stats/private/"; + "dffig2m" , "toolbox/stats/private/"; + "dfgetbinwidthdefaults" , "toolbox/stats/private/"; + "dfgetdistributions" , "toolbox/stats/private/"; + "dfgetexclusionrule" , "toolbox/stats/private/"; + "dfgetfitname" , "toolbox/stats/private/"; + "dfgetset" , "toolbox/stats/"; + "dfgetupdateinfo" , "toolbox/stats/private/"; + "dfgetuserdists" , "toolbox/stats/private/"; + "dfgraphexclude" , "toolbox/stats/private/"; + "dfhelpviewer" , "toolbox/stats/private/"; + "dfhistbins" , "toolbox/stats/private/"; + "dfildemo" , "toolbox/optim/"; + "dfilt2qfilt" , "toolbox/signal/sigtools/"; + "dfiltdemo" , "toolbox/signal/sigdemos/"; + "dfiltfftfirdemo" , "toolbox/signal/sigdemos/"; + "dfiltfilteringdemo" , "toolbox/signal/sigdemos/"; + "dfiltloadobj" , "toolbox/signal/sigtools/"; + "dfittool" , "toolbox/stats/"; + "dfpreview" , "toolbox/stats/private/"; + "dfreqrc" , "toolbox/robust/"; + "dfrqint" , "toolbox/control/ctrlobsolete/"; + "dfrqint2" , "toolbox/control/ctrlobsolete/"; + "dfsectionpreview" , "toolbox/stats/private/"; + "dfsession" , "toolbox/stats/private/"; + "dfsetbinwidthrules" , "toolbox/stats/private/"; + "dfsetconflev" , "toolbox/stats/private/"; + "dfsetdistributions" , "toolbox/stats/private/"; + "dfsetfunction" , "toolbox/stats/private/"; + "dfsetplottype" , "toolbox/stats/private/"; + "dfswitchyard" , "toolbox/stats/"; + "dftips" , "toolbox/stats/private/"; + "dftmtx" , "toolbox/signal/signal/"; + "dftoggleaxlimctrl" , "toolbox/stats/private/"; + "dftogglegrid" , "toolbox/stats/private/"; + "dftogglelegend" , "toolbox/stats/private/"; + "dftoggletoolbar" , "toolbox/stats/private/"; + "dftoolgetudd" , "toolbox/stats/private/"; + "dftoolinittemplate" , "toolbox/stats/private/"; + "dfupdateallplots" , "toolbox/stats/private/"; + "dfupdatebinwidthpreview" , "toolbox/stats/private/"; + "dfupdatelegend" , "toolbox/stats/private/"; + "dfupdateppdists" , "toolbox/stats/private/"; + "dfupdatexlim" , "toolbox/stats/private/"; + "dfupdateylim" , "toolbox/stats/private/"; + "dfviewdata" , "toolbox/stats/private/"; + "dfviewdatapreview" , "toolbox/stats/private/"; + "dfviewexcludepreview" , "toolbox/stats/private/"; + "dfviewpreview" , "toolbox/stats/private/"; + "dgammainc" , "toolbox/stats/private/"; + "dgram" , "toolbox/control/ctrlobsolete/"; + "dh2lqg" , "toolbox/robust/"; + "dhinf" , "toolbox/robust/"; + "dhinfopt" , "toolbox/robust/"; + "diagmx" , "toolbox/robust/"; + "diagnose" , "toolbox/shared/optimlib/"; + "dicom_add_attr" , "toolbox/images/images/private/"; + "dicom_add_item" , "toolbox/images/images/private/"; + "dicom_close_msg" , "toolbox/images/images/private/"; + "dicom_compress_pixel_cells" , "toolbox/images/images/private/"; + "dicom_convert_meta_to_attr" , "toolbox/images/images/private/"; + "dicom_copy_IOD" , "toolbox/images/images/private/"; + "dicom_create_IOD" , "toolbox/images/images/private/"; + "dicom_create_attr" , "toolbox/images/images/private/"; + "dicom_create_file_struct" , "toolbox/images/images/private/"; + "dicom_create_guid" , "toolbox/images/images/private/"; + "dicom_create_meta_struct" , "toolbox/images/images/private/"; + "dicom_decode_jpg8" , "toolbox/images/images/private/"; + "dicom_decode_pixel_cells" , "toolbox/images/images/private/"; + "dicom_decode_rle" , "toolbox/images/images/private/"; + "dicom_dict_lookup" , "toolbox/images/images/private/"; + "dicom_encode_attrs" , "toolbox/images/images/private/"; + "dicom_encode_jpeg_lossless" , "toolbox/images/images/private/"; + "dicom_encode_jpeg_lossy" , "toolbox/images/images/private/"; + "dicom_encode_pixel_cells" , "toolbox/images/images/private/"; + "dicom_encode_pn" , "toolbox/images/images/private/"; + "dicom_encode_rle" , "toolbox/images/images/private/"; + "dicom_generate_uid" , "toolbox/images/images/private/"; + "dicom_get_msg" , "toolbox/images/images/private/"; + "dicom_get_next_tag" , "toolbox/images/images/private/"; + "dicom_get_tags" , "toolbox/images/images/private/"; + "dicom_has_fmeta" , "toolbox/images/images/private/"; + "dicom_has_overlay_bits" , "toolbox/images/images/private/"; + "dicom_iods" , "toolbox/images/images/private/"; + "dicom_load_dictionary" , "toolbox/images/images/private/"; + "dicom_modules" , "toolbox/images/images/private/"; + "dicom_name_lookup" , "toolbox/images/images/private/"; + "dicom_open_msg" , "toolbox/images/images/private/"; + "dicom_prep_FileMetadata" , "toolbox/images/images/private/"; + "dicom_prep_FrameOfReference" , "toolbox/images/images/private/"; + "dicom_prep_GeneralImage" , "toolbox/images/images/private/"; + "dicom_prep_GeneralSeries" , "toolbox/images/images/private/"; + "dicom_prep_GeneralStudy" , "toolbox/images/images/private/"; + "dicom_prep_ImagePixel" , "toolbox/images/images/private/"; + "dicom_prep_SCImageEquipment" , "toolbox/images/images/private/"; + "dicom_prep_SOPCommon" , "toolbox/images/images/private/"; + "dicom_prep_metadata" , "toolbox/images/images/private/"; + "dicom_read_attr" , "toolbox/images/images/private/"; + "dicom_read_attr_by_pos" , "toolbox/images/images/private/"; + "dicom_read_attr_length" , "toolbox/images/images/private/"; + "dicom_read_attr_metadata" , "toolbox/images/images/private/"; + "dicom_read_attr_tag" , "toolbox/images/images/private/"; + "dicom_read_attr_vr" , "toolbox/images/images/private/"; + "dicom_read_encapsulated" , "toolbox/images/images/private/"; + "dicom_read_fmeta" , "toolbox/images/images/private/"; + "dicom_read_image" , "toolbox/images/images/private/"; + "dicom_read_mmeta" , "toolbox/images/images/private/"; + "dicom_read_native" , "toolbox/images/images/private/"; + "dicom_set_image_encoding" , "toolbox/images/images/private/"; + "dicom_set_imfinfo_values" , "toolbox/images/images/private/"; + "dicom_set_mmeta_encoding" , "toolbox/images/images/private/"; + "dicom_supported_txfr_syntax" , "toolbox/images/images/private/"; + "dicom_tag_lookup" , "toolbox/images/images/private/"; + "dicom_uid_decode" , "toolbox/images/images/private/"; + "dicom_warn" , "toolbox/images/images/private/"; + "dicom_write_stream" , "toolbox/images/images/private/"; + "dicom_xform_image" , "toolbox/images/images/private/"; + "dicomdict" , "toolbox/images/images/"; + "dicominfo" , "toolbox/images/images/"; + "dicomread" , "toolbox/images/images/"; + "dicomuid" , "toolbox/images/images/"; + "dicomwrite" , "toolbox/images/images/"; + "difeqdem" , "toolbox/splines/"; + "difeqite" , "toolbox/splines/"; + "difeqset" , "toolbox/splines/"; + "diffeqed" , "toolbox/simulink/dee/"; + "differentiator" , "toolbox/signal/signal/private/"; + "digitrevorder" , "toolbox/signal/signal/"; + "digits" , "toolbox/symbolic/"; + "dilate" , "toolbox/images/images/"; + "dimpulse" , "toolbox/control/ctrlobsolete/"; + "dinitial" , "toolbox/control/ctrlobsolete/"; + "dintdemo" , "toolbox/robust/"; + "dinteva" , "toolbox/robust/"; + "dintplt" , "toolbox/robust/"; + "dirac" , "toolbox/symbolic/"; + "diric" , "toolbox/signal/signal/"; + "disableimplicitsignalresolution" , "toolbox/simulink/simulink/"; + "diskdemo" , "toolbox/control/ctrldemos/"; + "diskdemo_aux" , "toolbox/control/ctrldemos/"; + "dispblocksmissed" , "toolbox/slcontrol/slctrlutil/"; + "display1" , "toolbox/optim/private/"; + "distchck" , "toolbox/stats/"; + "disttool" , "toolbox/stats/"; + "dither" , "toolbox/images/images/"; + "ditherc" , "toolbox/images/images/private/"; + "dividenowarn" , "toolbox/signal/signal/private/"; + "dkalman" , "toolbox/control/control/"; + "dlg_apply_bitops_to_all_charts" , "toolbox/stateflow/stateflow/private/"; + "dlg_apply_ui_checkbox" , "toolbox/stateflow/stateflow/private/"; + "dlg_call" , "toolbox/stateflow/stateflow/private/"; + "dlg_common_uis" , "toolbox/stateflow/stateflow/private/"; + "dlg_constants" , "toolbox/stateflow/stateflow/private/"; + "dlg_data" , "toolbox/stateflow/stateflow/private/"; + "dlg_edit_field" , "toolbox/stateflow/stateflow/private/"; + "dlg_enable_ui" , "toolbox/stateflow/stateflow/private/"; + "dlg_end_construction" , "toolbox/stateflow/stateflow/private/"; + "dlg_figure" , "toolbox/stateflow/stateflow/private/"; + "dlg_get_string" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_debugger" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_dest" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_document" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_object" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_parent" , "toolbox/stateflow/stateflow/private/"; + "dlg_goto_source" , "toolbox/stateflow/stateflow/private/"; + "dlg_is_iced" , "toolbox/stateflow/stateflow/private/"; + "dlg_mouse" , "toolbox/stateflow/stateflow/private/"; + "dlg_open" , "toolbox/stateflow/stateflow/private/"; + "dlg_origin" , "toolbox/stateflow/stateflow/private/"; + "dlg_refresh" , "toolbox/stateflow/stateflow/private/"; + "dlg_resize" , "toolbox/stateflow/stateflow/private/"; + "dlg_revert" , "toolbox/stateflow/stateflow/private/"; + "dlg_revert_property" , "toolbox/stateflow/stateflow/private/"; + "dlg_set" , "toolbox/stateflow/stateflow/private/"; + "dlg_set_string" , "toolbox/stateflow/stateflow/private/"; + "dlg_sort_uicontrols" , "toolbox/stateflow/stateflow/private/"; + "dlg_str_width" , "toolbox/stateflow/stateflow/private/"; + "dlg_sub_dialog" , "toolbox/stateflow/stateflow/private/"; + "dlg_trans_table" , "toolbox/stateflow/stateflow/private/"; + "dlg_update_parent_ui" , "toolbox/stateflow/stateflow/private/"; + "dlg_update_srcdst_ui" , "toolbox/stateflow/stateflow/private/"; + "dlg_update_subsystem_ui" , "toolbox/stateflow/stateflow/private/"; + "dlinmod" , "toolbox/simulink/simulink/"; + "dlinmodv5" , "toolbox/simulink/simulink/"; + "dlqe" , "toolbox/control/ctrlobsolete/"; + "dlqew" , "toolbox/control/ctrlobsolete/"; + "dlqr" , "toolbox/control/control/"; + "dlqrc" , "toolbox/robust/"; + "dlqry" , "toolbox/control/ctrlobsolete/"; + "dlsim" , "toolbox/control/ctrlobsolete/"; + "dlyap" , "toolbox/control/control/"; + "dlyapchol" , "toolbox/control/control/"; + "dmodred" , "toolbox/control/ctrlobsolete/"; + "dmulresp" , "toolbox/control/ctrlobsolete/"; + "dnichols" , "toolbox/control/ctrlobsolete/"; + "dnyquist" , "toolbox/control/ctrlobsolete/"; + "dobal" , "toolbox/robust/"; + "docblock" , "toolbox/simulink/blocks/"; + "docopt" , "toolbox/local/"; + "dogleg" , "toolbox/optim/private/"; + "dow_package_registry" , "toolbox/simulink/simulink/"; + "downsample" , "toolbox/signal/signal/"; + "dparseit" , "toolbox/simulink/dee/"; + "dpss" , "toolbox/signal/signal/"; + "dpssclear" , "toolbox/signal/signal/"; + "dpssdir" , "toolbox/signal/signal/"; + "dpssload" , "toolbox/signal/signal/"; + "dpsssave" , "toolbox/signal/signal/"; + "drawacc" , "toolbox/robust/"; + "drawpznumbers" , "toolbox/signal/signal/"; + "dreg" , "toolbox/control/ctrlobsolete/"; + "dric" , "toolbox/control/ctrlobsolete/"; + "driccond" , "toolbox/robust/"; + "drmodel" , "toolbox/control/control/"; + "drqpbox" , "toolbox/optim/private/"; + "drss" , "toolbox/control/control/"; + "drt_rtw_info_hook" , "toolbox/rtw/rtw/"; + "drum1" , "toolbox/pde/"; + "drum2" , "toolbox/pde/"; + "dsfunc" , "toolbox/simulink/blocks/"; + "dsigma" , "toolbox/control/ctrlobsolete/"; + "dskwheel" , "toolbox/control/ctrldemos/private/"; + "dsolve" , "toolbox/symbolic/"; + "dsort" , "toolbox/control/control/"; + "dspblksstatusbar" , "toolbox/signal/sigtools/"; + "dspblkstructures" , "toolbox/signal/sigtools/"; + "dspplugin" , "toolbox/signal/sigtools/"; + "dss" , "toolbox/control/control/"; + "dst" , "toolbox/pde/"; + "dstep" , "toolbox/control/ctrlobsolete/"; + "dtf2ss" , "toolbox/simulink/simulink/"; + "dtimscale" , "toolbox/ident/idutils/private/"; + "dtimvec" , "toolbox/control/ctrlobsolete/"; + "dtmfdemo" , "toolbox/signal/sigdemos/"; + "dtrend" , "toolbox/ident/idobsolete/"; + "dualsimplex" , "toolbox/optim/private/"; + "dummyvar" , "toolbox/stats/"; + "dump_exported_fcn_prototypes" , "toolbox/stateflow/coder/private/"; + "dump_module" , "toolbox/stateflow/coder/private/"; + "dynamicdlg" , "toolbox/shared/dastudio/"; + "ecdf" , "toolbox/stats/"; + "ecdfhist" , "toolbox/stats/"; + "ecg" , "toolbox/signal/sigdemos/"; + "edge" , "toolbox/images/images/"; + "edgedemo" , "toolbox/images/imdemos/"; + "edgelist2mask" , "toolbox/images/images/private/"; + "edgetaper" , "toolbox/images/images/"; + "elimone" , "toolbox/optim/"; + "ellip" , "toolbox/signal/signal/"; + "ellipap" , "toolbox/signal/signal/"; + "ellipord" , "toolbox/signal/signal/"; + "eml_blocks_in" , "toolbox/stateflow/stateflow/private/"; + "eml_chart_man" , "toolbox/stateflow/stateflow/private/"; + "eml_fcns_in" , "toolbox/stateflow/stateflow/private/"; + "eml_function_man" , "toolbox/stateflow/stateflow/private/"; + "eml_man" , "toolbox/stateflow/stateflow/private/"; + "eml_script_man" , "toolbox/stateflow/stateflow/private/"; + "eml_template_man" , "toolbox/stateflow/stateflow/private/"; + "emlnew" , "toolbox/stateflow/stateflow/"; + "emptyfixptsimrange" , "toolbox/simulink/fixedandfloat/"; + "enabdynprop" , "toolbox/signal/sigtools/"; + "encode_color" , "toolbox/images/images/private/"; + "encrypt_machine" , "toolbox/stateflow/stateflow/private/"; + "engunits" , "toolbox/signal/sigtools/"; + "eqtflength" , "toolbox/signal/signal/"; + "equation" , "toolbox/control/ctrldemos/private/"; + "erode" , "toolbox/images/images/"; + "esort" , "toolbox/control/control/"; + "esplit" , "toolbox/control/ctrlutil/"; + "estim" , "toolbox/control/control/"; + "etfe" , "toolbox/ident/ident/"; + "eucdist2" , "toolbox/images/images/private/"; + "eucdistn" , "toolbox/images/images/private/"; + "euler" , "toolbox/simulink/simulink/"; + "eulrotdisplay" , "toolbox/simulink/simdemos/simgeneral/"; + "evaluate_handle" , "toolbox/stateflow/stateflow/private/"; + "evaluate_handle_in_base_ws" , "toolbox/stateflow/stateflow/private/"; + "evaluatefs" , "toolbox/signal/sigtools/"; + "evaluatevars" , "toolbox/signal/sigtools/"; + "evcdf" , "toolbox/stats/"; + "eventddg" , "toolbox/stateflow/stateflow/private/"; + "eventddg_port_callback" , "toolbox/stateflow/stateflow/private/"; + "eventddg_preapply_callback" , "toolbox/stateflow/stateflow/private/"; + "eventddg_preclose_callback" , "toolbox/stateflow/stateflow/private/"; + "eventdlg" , "toolbox/stateflow/stateflow/private/"; + "evfit" , "toolbox/stats/"; + "evinv" , "toolbox/stats/"; + "evlike" , "toolbox/stats/"; + "evnegloglike" , "toolbox/stats/"; + "evpdf" , "toolbox/stats/"; + "evrnd" , "toolbox/stats/"; + "evstat" , "toolbox/stats/"; + "ewmaplot" , "toolbox/stats/"; + "execute_in_java_thread" , "toolbox/stateflow/stateflow/private/"; + "expand_double_byte_string" , "toolbox/stateflow/stateflow/private/"; + "expcdf" , "toolbox/stats/"; + "expfit" , "toolbox/stats/"; + "expinv" , "toolbox/stats/"; + "explike" , "toolbox/stats/"; + "explore_system" , "toolbox/simulink/simulink/"; + "explr_config_colormap" , "toolbox/stateflow/stateflow/private/"; + "explr_obj_del" , "toolbox/stateflow/stateflow/private/"; + "explr_position" , "toolbox/stateflow/stateflow/private/"; + "export2wsdlg" , "toolbox/stats/private/"; + "export_chart_functions" , "toolbox/stateflow/coder/private/"; + "exportccsplugin" , "toolbox/signal/sigtools/"; + "exportcoeffgen" , "toolbox/signal/sigtools/"; + "exported_fcn_checksum" , "toolbox/stateflow/stateflow/private/"; + "exported_fcns_in_machine" , "toolbox/stateflow/stateflow/private/"; + "exportlti" , "toolbox/control/ctrlguis/"; + "exppdf" , "toolbox/stats/"; + "exprnd" , "toolbox/stats/"; + "expstat" , "toolbox/stats/"; + "exresp" , "toolbox/control/ctrlobsolete/"; + "extendlocus" , "toolbox/control/ctrlguis/"; + "external_temp_limit" , "toolbox/simulink/simdemos/automotive/"; + "external_temp_limit1" , "toolbox/simulink/simdemos/automotive/"; + "extmode_transports" , "toolbox/simulink/simulink/"; + "extmodecallback" , "toolbox/simulink/simulink/private/"; + "extract_norw" , "toolbox/signal/signal/private/"; + "extract_relevant_dirs" , "toolbox/stateflow/stateflow/private/"; + "f14_digdemo" , "toolbox/simulink/simdemos/aerospace/"; + "f14_show" , "toolbox/simulink/simdemos/aerospace/"; + "f14dat" , "toolbox/simulink/simdemos/aerospace/"; + "f14dat_digital" , "toolbox/simulink/simdemos/aerospace/"; + "f14def" , "toolbox/simulink/simdemos/aerospace/"; + "factoran" , "toolbox/stats/"; + "factorandemo" , "toolbox/stats/"; + "factorymenu" , "toolbox/signal/sigtools/"; + "faddmenu" , "toolbox/signal/sigtools/"; + "fan2para" , "toolbox/images/images/"; + "fan2para_int" , "toolbox/images/images/private/"; + "fanbeam" , "toolbox/images/images/"; + "fastreshape" , "toolbox/signal/signal/"; + "fbode" , "toolbox/control/ctrlobsolete/"; + "fbox4" , "toolbox/optim/"; + "fcdf" , "toolbox/stats/"; + "fcfileread" , "toolbox/signal/sigtools/"; + "fdaddcontextmenu" , "toolbox/signal/sigtools/"; + "fdaprivate" , "toolbox/signal/sigtools/"; + "fdatool" , "toolbox/signal/sigtools/"; + "fdatool_cfi" , "toolbox/signal/sigtools/private/"; + "fdatool_design" , "toolbox/signal/sigtools/private/"; + "fdatool_fvtool" , "toolbox/signal/sigtools/private/"; + "fdatool_help" , "toolbox/signal/sigtools/"; + "fdatool_import" , "toolbox/signal/sigtools/private/"; + "fdatool_mfilttool" , "toolbox/signal/sigtools/private/"; + "fdatool_pzeditor" , "toolbox/signal/sigtools/private/"; + "fdatool_qfiltpanel" , "toolbox/signal/sigtools/private/"; + "fdatool_sidebar" , "toolbox/signal/sigtools/private/"; + "fdatool_xformtool" , "toolbox/signal/sigtools/private/"; + "fdbutter" , "toolbox/signal/sptoolgui/"; + "fdcheby1" , "toolbox/signal/sptoolgui/"; + "fdcheby2" , "toolbox/signal/sptoolgui/"; + "fdellip" , "toolbox/signal/sptoolgui/"; + "fdfirls" , "toolbox/signal/sptoolgui/"; + "fdhelpstr" , "toolbox/signal/sptoolgui/private/"; + "fdkaiser" , "toolbox/signal/sptoolgui/"; + "fdmodp" , "toolbox/signal/sptoolgui/private/"; + "fdobjhelp" , "toolbox/signal/sptoolgui/private/"; + "fdplugin" , "toolbox/signal/sigtools/"; + "fdpzedit" , "toolbox/signal/sptoolgui/"; + "fdremez" , "toolbox/signal/sptoolgui/"; + "fdrmmenu" , "toolbox/signal/sigtools/"; + "fdrmtoolbarbtn" , "toolbox/signal/sigtools/"; + "fduiputfile" , "toolbox/signal/sigtools/"; + "fdutil" , "toolbox/signal/sptoolgui/"; + "feasibl" , "toolbox/optim/private/"; + "feedback" , "toolbox/control/control/"; + "feedbk" , "toolbox/robust/"; + "fevaldlg" , "toolbox/simulink/dee/"; + "ff2n" , "toolbox/stats/"; + "ffplot" , "toolbox/ident/ident/"; + "fftfilt" , "toolbox/signal/signal/"; + "fgoalattain" , "toolbox/optim/"; + "fiactha" , "toolbox/ident/idguis/"; + "fiacthad" , "toolbox/ident/idguis/"; + "fiactham" , "toolbox/ident/idguis/"; + "figpos" , "toolbox/simulink/simulink/private/"; + "file2str" , "toolbox/stateflow/stateflow/private/"; + "filt" , "toolbox/control/control/"; + "filtcon" , "toolbox/optim/"; + "filtdem" , "toolbox/signal/sigdemos/"; + "filtdem2" , "toolbox/signal/sigdemos/"; + "filtdemo" , "toolbox/signal/sigdemos/"; + "filtdes" , "toolbox/signal/sptoolgui/"; + "filter_deleted_ids" , "toolbox/stateflow/stateflow/private/"; + "filterguitar" , "toolbox/signal/sigdemos/"; + "filterguitardemo" , "toolbox/signal/sigdemos/"; + "filternorm" , "toolbox/signal/signal/"; + "filtfilt" , "toolbox/signal/signal/"; + "filtfun" , "toolbox/optim/"; + "filtfun2" , "toolbox/optim/"; + "filtic" , "toolbox/signal/signal/"; + "filtm" , "toolbox/simulink/blocks/"; + "filtobj" , "toolbox/optim/"; + "filtview" , "toolbox/signal/sptoolgui/"; + "find_by_type" , "toolbox/stateflow/stateflow/private/"; + "find_dv" , "toolbox/shared/dastudio/"; + "find_mdlrefs" , "toolbox/simulink/simulink/"; + "find_model_reference_candidates" , "toolbox/simulink/simulink/private/"; + "find_system" , "toolbox/simulink/simulink/"; + "find_target_files" , "toolbox/stateflow/stateflow/private/"; + "findallwinclasses" , "toolbox/signal/sigtools/"; + "findblib" , "toolbox/simulink/simulink/"; + "findbounds" , "toolbox/images/images/"; + "findbussrc" , "toolbox/simulink/simulink/private/"; + "findcstr" , "toolbox/signal/sptoolgui/private/"; + "findfilters" , "toolbox/signal/sigtools/"; + "findif" , "toolbox/simulink/simulink/private/"; + "findmax" , "toolbox/optim/"; + "findmax2" , "toolbox/optim/"; + "findnk" , "toolbox/ident/idutils/"; + "findnonabstractsubclasses" , "toolbox/signal/sigtools/"; + "findop" , "toolbox/slcontrol/slcontrol/"; + "findp" , "toolbox/optim/private/"; + "findplugins" , "toolbox/signal/sigtools/private/"; + "findslobj" , "toolbox/simulink/simulink/"; + "findtau" , "toolbox/ident/idutils/"; + "findzero" , "toolbox/ident/idutils/"; + "finishdlg" , "toolbox/local/"; + "finishsav" , "toolbox/local/"; + "finitedifferences" , "toolbox/shared/optimlib/"; + "finv" , "toolbox/stats/"; + "fipert_qr" , "toolbox/ident/idutils/private/"; + "fir1" , "toolbox/signal/signal/"; + "fir2" , "toolbox/signal/signal/"; + "firchk" , "toolbox/signal/signal/private/"; + "fircls" , "toolbox/signal/signal/"; + "fircls1" , "toolbox/signal/signal/"; + "firdemo" , "toolbox/images/imdemos/"; + "fire_show" , "toolbox/stateflow/sfdemos/"; + "firgauss" , "toolbox/signal/signal/"; + "firls" , "toolbox/signal/signal/"; + "firpm" , "toolbox/signal/signal/"; + "firpmfrf" , "toolbox/signal/signal/private/"; + "firpmord" , "toolbox/signal/signal/"; + "firrcos" , "toolbox/signal/signal/"; + "fitd" , "toolbox/robust/"; + "fitdecorrtrans" , "toolbox/images/images/private/"; + "fitfun2" , "toolbox/optim/"; + "fitfun2outputfcn" , "toolbox/optim/"; + "fitgain" , "toolbox/robust/"; + "fix_corrupted_grouped_bits" , "toolbox/stateflow/stateflow/private/"; + "fix_corrupted_sf_blocks" , "toolbox/stateflow/stateflow/private/"; + "fix_corrupted_subgroups" , "toolbox/stateflow/stateflow/private/"; + "fix_outport_initial_values" , "toolbox/stateflow/stateflow/private/"; + "fixdt" , "toolbox/simulink/fixedandfloat/"; + "fixedfont" , "toolbox/signal/sptoolgui/private/"; + "fixmult" , "toolbox/robust/"; + "fixpar" , "toolbox/ident/idobsolete/"; + "fixpoint" , "toolbox/simulink/fixedandfloat/"; + "fixpt" , "toolbox/simulink/fixedandfloat/"; + "fixptPrivate" , "toolbox/simulink/fixedandfloat/"; + "fixpt_blks_in_mdl" , "toolbox/simulink/simulink/private/"; + "fixpt_clear_tag" , "toolbox/simulink/fixedandfloat/"; + "fixpt_evenspace_cleanup" , "toolbox/simulink/fixedandfloat/"; + "fixpt_extractbits_mask" , "toolbox/simulink/fixedandfloat/"; + "fixpt_extractbits_mask_script" , "toolbox/simulink/fixedandfloat/"; + "fixpt_fir_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_gain_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_interp1" , "toolbox/simulink/fixedandfloat/"; + "fixpt_look1_func_approx" , "toolbox/simulink/fixedandfloat/"; + "fixpt_look1_func_plot" , "toolbox/simulink/fixedandfloat/"; + "fixpt_look1_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_look2_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_mask_disp_prep" , "toolbox/simulink/fixedandfloat/"; + "fixpt_mpswitch_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_mul_mask_data" , "toolbox/simulink/fixedandfloat/"; + "fixpt_mul_mask_data_str" , "toolbox/simulink/fixedandfloat/"; + "fixpt_set_all" , "toolbox/simulink/fixedandfloat/"; + "fixptbestexp" , "toolbox/simulink/fixedandfloat/"; + "fixptbestprec" , "toolbox/simulink/fixedandfloat/"; + "fixptdeftype" , "toolbox/simulink/fixedandfloat/"; + "fixptdialog" , "toolbox/simulink/fixedandfloat/"; + "fixptlibname" , "toolbox/simulink/fixedandfloat/"; + "fixptmaskinit" , "toolbox/simulink/fixedandfloat/"; + "fixptopt" , "toolbox/simulink/fixedandfloat/"; + "fixradix" , "toolbox/simulink/fixedandfloat/obsolete/"; + "fixscale" , "toolbox/simulink/fixedandfloat/obsolete/"; + "fixslope" , "toolbox/simulink/fixedandfloat/obsolete/"; + "fixup_uiedit" , "toolbox/signal/sigtools/"; + "flattopwin" , "toolbox/signal/signal/"; + "fleq3" , "toolbox/optim/"; + "fliptform" , "toolbox/images/images/"; + "float" , "toolbox/simulink/fixedandfloat/"; + "fmincon" , "toolbox/optim/"; + "fminimax" , "toolbox/optim/"; + "fminunc" , "toolbox/optim/"; + "fminusub" , "toolbox/optim/private/"; + "fn2fm" , "toolbox/splines/"; + "fnbrk" , "toolbox/splines/"; + "fnchg" , "toolbox/splines/"; + "fncmb" , "toolbox/splines/"; + "fnd_objprop" , "toolbox/stateflow/stateflow/private/"; + "fnd_runsearch" , "toolbox/stateflow/stateflow/private/"; + "fnder" , "toolbox/splines/"; + "fndir" , "toolbox/splines/"; + "fnint" , "toolbox/splines/"; + "fnjmp" , "toolbox/splines/"; + "fnmin" , "toolbox/splines/"; + "fnplt" , "toolbox/splines/"; + "fnrfn" , "toolbox/splines/"; + "fntlr" , "toolbox/splines/"; + "fnval" , "toolbox/splines/"; + "fnzeros" , "toolbox/splines/"; + "foccheck" , "toolbox/ident/idutils/"; + "focus_explorer_on_model_configuration" , "toolbox/simulink/simulink/private/"; + "foptions" , "toolbox/simulink/simulink/"; + "foreach" , "toolbox/simulink/simulink/private/"; + "fpbhelp" , "toolbox/simulink/fixedandfloat/"; + "fpdf" , "toolbox/stats/"; + "fqf2ido" , "toolbox/ident/idobsolete/"; + "fquad" , "toolbox/optim/private/"; + "fracfact" , "toolbox/stats/"; + "frame" , "toolbox/stateflow/stateflow/private/"; + "frameedit" , "toolbox/simulink/simulink/"; + "framelab" , "toolbox/signal/sptoolgui/private/"; + "framewlabel" , "toolbox/signal/sigtools/"; + "franke" , "toolbox/splines/"; + "frefine" , "toolbox/signal/signal/private/"; + "freqchk" , "toolbox/signal/signal/private/"; + "freqfocus" , "toolbox/ident/idutils/private/"; + "freqint" , "toolbox/control/ctrlobsolete/"; + "freqint2" , "toolbox/control/ctrlobsolete/"; + "freqkern" , "toolbox/ident/idutils/"; + "freqpick" , "toolbox/ident/idutils/private/"; + "freqplotter" , "toolbox/signal/sigtools/"; + "freqrc" , "toolbox/robust/"; + "freqresp" , "toolbox/control/control/"; + "freqs" , "toolbox/signal/signal/"; + "freqz" , "toolbox/signal/signal/"; + "freqz2" , "toolbox/images/images/"; + "freqz_freqvec" , "toolbox/signal/signal/"; + "freqzparse" , "toolbox/signal/signal/"; + "freqzplot" , "toolbox/signal/signal/"; + "friedman" , "toolbox/stats/"; + "frmcell" , "toolbox/stateflow/stateflow/private/"; + "frnd" , "toolbox/stats/"; + "fromddg" , "toolbox/simulink/blocks/"; + "fsamp2" , "toolbox/images/images/"; + "fsdialog" , "toolbox/signal/sigtools/"; + "fseminf" , "toolbox/optim/"; + "fsolve" , "toolbox/optim/"; + "fspecial" , "toolbox/images/images/"; + "fstab" , "toolbox/ident/idutils/"; + "fstat" , "toolbox/stats/"; + "fsub_estim" , "toolbox/ident/idutils/"; + "fsurfht" , "toolbox/stats/"; + "ftrans2" , "toolbox/images/images/"; + "fullfact" , "toolbox/stats/"; + "fullviewlink" , "toolbox/signal/sigtools/private/"; + "function_prototype_utils" , "toolbox/stateflow/stateflow/private/"; + "functiontostring" , "toolbox/optim/"; + "funtool" , "toolbox/symbolic/"; + "fvhelpstr" , "toolbox/signal/sptoolgui/private/"; + "fvinit" , "toolbox/signal/sptoolgui/private/"; + "fvmotion" , "toolbox/signal/sptoolgui/private/"; + "fvresize" , "toolbox/signal/sptoolgui/private/"; + "fvtool" , "toolbox/signal/sigtools/"; + "fvtooldemo" , "toolbox/signal/sigdemos/"; + "fvtoolwaddnreplace" , "toolbox/signal/sigtools/"; + "fvzoom" , "toolbox/signal/sptoolgui/private/"; + "fwind1" , "toolbox/images/images/"; + "fwind2" , "toolbox/images/images/"; + "fxpdemo_approx_sin" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "fxptdlg" , "toolbox/simulink/fixedandfloat/"; + "fxptplt" , "toolbox/simulink/fixedandfloat/"; + "fzmult" , "toolbox/optim/"; + "gamcdf" , "toolbox/stats/"; + "gamfit" , "toolbox/stats/"; + "gaminv" , "toolbox/stats/"; + "gamlike" , "toolbox/stats/"; + "gampdf" , "toolbox/stats/"; + "gamrnd" , "toolbox/stats/"; + "gamstat" , "toolbox/stats/"; + "gangstr" , "toolbox/optim/"; + "gauspuls" , "toolbox/signal/signal/"; + "gausswin" , "toolbox/signal/signal/"; + "gcare" , "toolbox/control/control/"; + "gcb" , "toolbox/simulink/simulink/"; + "gcbh" , "toolbox/simulink/simulink/"; + "gcr" , "toolbox/control/ctrlguis/"; + "gcs" , "toolbox/simulink/simulink/"; + "gdare" , "toolbox/control/control/"; + "gear" , "toolbox/simulink/simulink/"; + "gencoswin" , "toolbox/signal/signal/private/"; + "generate_code_for_charts_and_machine" , "toolbox/stateflow/coder/private/"; + "generate_results" , "toolbox/simulink/simcoverage/private/"; + "generatemsgid" , "toolbox/signal/sigtools/"; + "genericddg" , "toolbox/simulink/simulink/"; + "genmcode" , "toolbox/signal/sigtools/"; + "genmcodeutils" , "toolbox/signal/sigtools/"; + "genplotdata" , "toolbox/signal/signal/"; + "gensig" , "toolbox/control/control/"; + "geocdf" , "toolbox/stats/"; + "geoinv" , "toolbox/stats/"; + "geomean" , "toolbox/stats/"; + "geopdf" , "toolbox/stats/"; + "geornd" , "toolbox/stats/"; + "geostat" , "toolbox/stats/"; + "getActiveCode" , "toolbox/simulink/simulink/"; + "getActiveConfigSet" , "toolbox/simulink/simulink/"; + "getConfigSet" , "toolbox/simulink/simulink/"; + "getConfigSets" , "toolbox/simulink/simulink/"; + "getDAWorkspace" , "toolbox/shared/dastudio/"; + "getHardwareConfigs" , "toolbox/simulink/simulink/"; + "getMappingOldMaskToCurrent" , "toolbox/simulink/simulink/private/"; + "getSoftwareEnvironments" , "toolbox/simulink/simulink/"; + "getWorkspaceWrapper" , "toolbox/shared/dastudio/"; + "get_autoinheritance_info" , "toolbox/stateflow/stateflow/private/"; + "get_boiler_plate_comment" , "toolbox/stateflow/coder/private/"; + "get_boolean_rtw_option" , "toolbox/stateflow/coder/private/"; + "get_charts_of" , "toolbox/stateflow/stateflow/private/"; + "get_checksum_from_dll" , "toolbox/stateflow/stateflow/private/"; + "get_clipboard_machine" , "toolbox/stateflow/stateflow/private/"; + "get_datestring" , "toolbox/stateflow/stateflow/private/"; + "get_eml_script" , "toolbox/simulink/simulink/"; + "get_ert_multi_instance_errcode" , "toolbox/stateflow/coder/private/"; + "get_filepath_from_user" , "toolbox/stateflow/stateflow/private/"; + "get_fxpprop_from_name" , "toolbox/simulink/blocks/private/"; + "get_image_title" , "toolbox/images/images/private/"; + "get_instances_in_machine" , "toolbox/stateflow/stateflow/private/"; + "get_link_chart_file_numbers" , "toolbox/stateflow/stateflow/private/"; + "get_link_machine_list" , "toolbox/stateflow/stateflow/private/"; + "get_mdl_dir" , "toolbox/simulink/simulink/private/"; + "get_model_reference_info" , "toolbox/stateflow/coder/private/"; + "get_ordered_model_references" , "toolbox/simulink/simulink/private/"; + "get_param" , "toolbox/simulink/simulink/"; + "get_params_str_for_chart" , "toolbox/stateflow/stateflow/private/"; + "get_relevant_machine" , "toolbox/stateflow/coder/private/"; + "get_sf_block_port_info" , "toolbox/stateflow/stateflow/private/"; + "get_stateflow_path_to_parent" , "toolbox/stateflow/stateflow/private/"; + "get_test_point_properties" , "toolbox/stateflow/stateflow/private/"; + "get_tmf_for_target" , "toolbox/rtw/rtw/"; + "get_valid_property_values" , "toolbox/stateflow/stateflow/private/"; + "get_value_of_fields" , "toolbox/rtw/rtw/"; + "get_wksp_data_for_chart" , "toolbox/stateflow/stateflow/private/"; + "get_wksp_data_names_for_chart" , "toolbox/stateflow/stateflow/private/"; + "get_word_sizes" , "toolbox/stateflow/coder/private/"; + "getargth" , "toolbox/ident/idobsolete/"; + "getarxms" , "toolbox/ident/idutils/"; + "getblocklinearizeio" , "toolbox/slcontrol/slctrlguis/private/"; + "getblocklinio" , "toolbox/slcontrol/slctrlutil/"; + "getclassindex" , "toolbox/stats/private/"; + "getcolorfromindex" , "toolbox/signal/sigtools/"; + "getconstructorfromstructure" , "toolbox/signal/sigtools/"; + "getcurpt" , "toolbox/images/images/private/"; + "getcurv2" , "toolbox/splines/"; + "getcurve" , "toolbox/splines/"; + "getdatatypespecs" , "toolbox/simulink/fixedandfloat/"; + "getdiscdata" , "toolbox/simulink/components/"; + "getdsdb" , "toolbox/stats/private/"; + "getfdasessionhandle" , "toolbox/signal/sigtools/"; + "getff" , "toolbox/ident/idobsolete/"; + "getfitdb" , "toolbox/stats/private/"; + "getfreqlbl" , "toolbox/signal/sigtools/"; + "getfrequnitstrs" , "toolbox/signal/sigtools/"; + "getfullname" , "toolbox/simulink/simulink/"; + "getgloballog" , "toolbox/simulink/fixedandfloat/"; + "gethgstackorder" , "toolbox/signal/sigtools/"; + "getimage" , "toolbox/images/images/"; + "getinternaldiscfunction" , "toolbox/simulink/components/private/"; + "getinterpfrequencies" , "toolbox/signal/signal/private/"; + "getlevel" , "toolbox/simulink/simulink/private/"; + "getline" , "toolbox/images/images/"; + "getlinio" , "toolbox/slcontrol/slcontrol/"; + "getlinplant" , "toolbox/slcontrol/slcontrol/"; + "getmagunitstrs" , "toolbox/signal/sigtools/"; + "getmfth" , "toolbox/ident/idobsolete/"; + "getncap" , "toolbox/ident/idobsolete/"; + "getolmodel" , "toolbox/slcontrol/slctrlutil/"; + "getoutlierdb" , "toolbox/stats/private/"; + "getpts" , "toolbox/images/images/"; + "getrect" , "toolbox/images/images/"; + "getsigpref" , "toolbox/signal/sptoolgui/"; + "getsro" , "toolbox/sloptim/sloptim/"; + "getsys" , "toolbox/simulink/dee/"; + "gett" , "toolbox/ident/idobsolete/"; + "gettargdatamap" , "toolbox/rtw/rtw/"; + "gettargetcharshortintlong" , "toolbox/simulink/fixedandfloat/"; + "getvalidproject" , "toolbox/shared/slcontrollib/"; + "getwinobject" , "toolbox/signal/sigtools/"; + "getxo" , "toolbox/simulink/blocks/"; + "getxu" , "toolbox/slcontrol/slcontrol/"; + "getzeros" , "toolbox/control/ctrlutil/"; + "getzp" , "toolbox/ident/idobsolete/"; + "givens" , "toolbox/control/ctrlobsolete/"; + "gline" , "toolbox/stats/"; + "glmdemo" , "toolbox/stats/"; + "glmfit" , "toolbox/stats/"; + "glmval" , "toolbox/stats/"; + "glyphplot" , "toolbox/stats/"; + "gmonopuls" , "toolbox/signal/signal/"; + "gname" , "toolbox/stats/"; + "gnnans" , "toolbox/ident/idutils/private/"; + "gnnans_f" , "toolbox/ident/idutils/private/"; + "gnnew" , "toolbox/ident/idutils/"; + "gnnew_f" , "toolbox/ident/idutils/"; + "gnnew_fp" , "toolbox/ident/idutils/"; + "goalcon" , "toolbox/optim/"; + "goaldemo" , "toolbox/optim/"; + "goalfun" , "toolbox/optim/"; + "goertzel" , "toolbox/signal/signal/"; + "goto_target" , "toolbox/stateflow/stateflow/private/"; + "gotoddg" , "toolbox/simulink/blocks/"; + "gotoddg_cb" , "toolbox/simulink/simulink/"; + "gparetodemo" , "toolbox/stats/"; + "gpdhelp" , "toolbox/stateflow/stateflow/private/"; + "gpicon" , "toolbox/stateflow/stateflow/private/"; + "gplotmatrix" , "toolbox/stats/"; + "gpnegloglike" , "toolbox/stats/"; + "gpnegloglike2" , "toolbox/stats/"; + "gpzoom" , "toolbox/stateflow/stateflow/private/"; + "graderr" , "toolbox/simulink/simulink/private/"; + "graderr" , "toolbox/shared/optimlib/"; + "graft" , "toolbox/robust/"; + "gram" , "toolbox/control/ctrlobsolete/"; + "grandfather" , "toolbox/stateflow/stateflow/private/"; + "grandfather_precedence" , "toolbox/stateflow/stateflow/private/"; + "gray2ind" , "toolbox/images/images/"; + "grayslice" , "toolbox/images/images/"; + "graythresh" , "toolbox/images/images/"; + "grayto16" , "toolbox/images/images/private/"; + "grayto8" , "toolbox/images/images/private/"; + "gridline" , "toolbox/control/ctrldemos/private/"; + "gridopts" , "toolbox/control/ctrlguis/"; + "gridunc" , "toolbox/sloptim/sloptim/"; + "ground" , "toolbox/control/ctrldemos/private/"; + "groupbox" , "toolbox/simulink/simulink/private/"; + "groupbox" , "toolbox/stateflow/stateflow/private/"; + "grp2idx" , "toolbox/stats/"; + "grpdelay" , "toolbox/signal/signal/"; + "grpstats" , "toolbox/stats/"; + "gscatter" , "toolbox/stats/"; + "gui_sizes" , "toolbox/signal/sigtools/private/"; + "h2data" , "toolbox/robust/"; + "h2des1" , "toolbox/robust/"; + "h2lqg" , "toolbox/robust/"; + "hamming" , "toolbox/signal/signal/"; + "hann" , "toolbox/signal/signal/"; + "hanning" , "toolbox/signal/signal/"; + "harmmean" , "toolbox/stats/"; + "hasmask" , "toolbox/simulink/simulink/"; + "hasmaskdlg" , "toolbox/simulink/simulink/"; + "hasmaskicon" , "toolbox/simulink/simulink/"; + "hdsCatArray" , "toolbox/shared/hds/"; + "hdsGetSize" , "toolbox/shared/hds/"; + "hdsGetSlice" , "toolbox/shared/hds/"; + "hdsNewArray" , "toolbox/shared/hds/"; + "hdsReplicateArray" , "toolbox/shared/hds/"; + "hdsReshapeArray" , "toolbox/shared/hds/"; + "hdsSetSlice" , "toolbox/shared/hds/"; + "heatex" , "toolbox/control/ctrldemos/"; + "heatex_clbk" , "toolbox/control/ctrldemos/"; + "heatex_getdata" , "toolbox/control/ctrldemos/"; + "heatex_sls" , "toolbox/control/ctrldemos/"; + "heaviside" , "toolbox/symbolic/"; + "helplinf" , "toolbox/robust/"; + "hessabc" , "toolbox/control/ctrlutil/"; + "hgrc" , "toolbox/local/"; + "hidecrit" , "toolbox/simulink/components/"; + "hiercheck" , "toolbox/stateflow/stateflow/private/"; + "highpass" , "toolbox/signal/signal/private/"; + "hilbert" , "toolbox/signal/signal/"; + "hilbfilt" , "toolbox/signal/signal/private/"; + "hilite_system" , "toolbox/simulink/simulink/"; + "hilitediscblock" , "toolbox/simulink/components/"; + "hinf" , "toolbox/robust/"; + "hinfdata" , "toolbox/robust/"; + "hinfdemo" , "toolbox/robust/"; + "hinfdes1" , "toolbox/robust/"; + "hinfkgjd" , "toolbox/robust/"; + "hinflim" , "toolbox/robust/"; + "hinfopt" , "toolbox/robust/"; + "hist3" , "toolbox/stats/"; + "histeq" , "toolbox/images/images/"; + "histfit" , "toolbox/stats/"; + "histodem" , "toolbox/splines/"; + "hkl1" , "toolbox/robust/"; + "hkl2" , "toolbox/robust/"; + "hkl3" , "toolbox/robust/"; + "hkl4" , "toolbox/robust/"; + "hksv" , "toolbox/robust/"; + "hmatdemo" , "toolbox/robust/"; + "hmfbx4" , "toolbox/optim/"; + "hmfleq1" , "toolbox/optim/"; + "hmmdecode" , "toolbox/stats/"; + "hmmestimate" , "toolbox/stats/"; + "hmmgenerate" , "toolbox/stats/"; + "hmmtrain" , "toolbox/stats/"; + "hmmviterbi" , "toolbox/stats/"; + "hmult" , "toolbox/optim/private/"; + "hostid" , "toolbox/local/"; + "hougen" , "toolbox/stats/"; + "hoverfig" , "toolbox/shared/controllib/"; + "hplant" , "toolbox/robust/"; + "hprecon" , "toolbox/optim/"; + "hqr10" , "toolbox/robust/"; + "htdes1" , "toolbox/robust/"; + "hygecdf" , "toolbox/stats/"; + "hygeinv" , "toolbox/stats/"; + "hygepdf" , "toolbox/stats/"; + "hygernd" , "toolbox/stats/"; + "hygestat" , "toolbox/stats/"; + "hyperbolic" , "toolbox/pde/"; + "hypergeom" , "toolbox/symbolic/"; + "icceps" , "toolbox/signal/signal/"; + "iccread" , "toolbox/images/images/"; + "icdf" , "toolbox/stats/"; + "iconedit" , "toolbox/simulink/simulink/"; + "idarxstr" , "toolbox/ident/idguis/"; + "idbuildw" , "toolbox/ident/idguis/"; + "idbwtext" , "toolbox/ident/idguis/"; + "idchi2" , "toolbox/ident/idutils/"; + "idchnona" , "toolbox/ident/idutils/"; + "idcmdld" , "toolbox/ident/idguis/"; + "idconfcp" , "toolbox/ident/idguis/"; + "idct" , "toolbox/signal/signal/"; + "idct" , "toolbox/images/images/private/"; + "idct2" , "toolbox/images/images/"; + "idctold" , "toolbox/signal/signal/private/"; + "iddatfig" , "toolbox/ident/idguis/"; + "iddef" , "toolbox/ident/idutils/"; + "iddeft" , "toolbox/ident/idutils/"; + "iddefw" , "toolbox/ident/idutils/"; + "iddemo" , "toolbox/ident/iddemos/"; + "iddemo1" , "toolbox/ident/iddemos/"; + "iddemo2" , "toolbox/ident/iddemos/"; + "iddemo3" , "toolbox/ident/iddemos/"; + "iddemo4" , "toolbox/ident/iddemos/"; + "iddemo5" , "toolbox/ident/iddemos/"; + "iddemo6" , "toolbox/ident/iddemos/"; + "iddemo7" , "toolbox/ident/iddemos/"; + "iddemo8" , "toolbox/ident/iddemos/"; + "iddemo9" , "toolbox/ident/iddemos/"; + "iddemofr" , "toolbox/ident/iddemos/"; + "iddemopr" , "toolbox/ident/iddemos/"; + "iddemosl" , "toolbox/ident/iddemos/"; + "iddfthru" , "toolbox/ident/idutils/"; + "iddfthru" , "toolbox/ident/ident/"; + "iddmtab" , "toolbox/ident/idguis/"; + "ident" , "toolbox/ident/idguis/"; + "identsinkwrite" , "toolbox/ident/idutils/"; + "identsinkwrite" , "toolbox/ident/ident/"; + "idextmat" , "toolbox/ident/idutils/"; + "idfilt" , "toolbox/ident/ident/"; + "idfrd2iddata" , "toolbox/ident/idutils/"; + "idgenfig" , "toolbox/ident/idguis/"; + "idgtws" , "toolbox/ident/idguis/"; + "idgwarn" , "toolbox/ident/idguis/"; + "idhelp" , "toolbox/ident/ident/"; + "idinput" , "toolbox/ident/ident/"; + "idinseva" , "toolbox/ident/idguis/"; + "idlayout" , "toolbox/ident/idguis/"; + "idlaytab" , "toolbox/ident/idguis/"; + "idltifr" , "toolbox/ident/idutils/"; + "idmdlmask" , "toolbox/ident/idutils/"; + "idmhit" , "toolbox/ident/idguis/"; + "idmodred" , "toolbox/ident/ident/"; + "idmsize" , "toolbox/ident/idutils/"; + "idmspop" , "toolbox/ident/idguis/"; + "idmwwb" , "toolbox/ident/idguis/"; + "idnamchk" , "toolbox/ident/idutils/"; + "idnamede" , "toolbox/ident/idutils/"; + "idnextw" , "toolbox/ident/idguis/"; + "idnonzer" , "toolbox/ident/idguis/"; + "ido2th" , "toolbox/ident/idobsolete/"; + "idoptcmp" , "toolbox/ident/idguis/"; + "idopttog" , "toolbox/ident/idguis/"; + "idparest" , "toolbox/ident/idguis/"; + "idplot" , "toolbox/ident/idobsolete/"; + "idprocest" , "toolbox/ident/idguis/"; + "idprops" , "toolbox/ident/ident/"; + "idresamp" , "toolbox/ident/idobsolete/"; + "idresamp" , "toolbox/ident/ident/"; + "idsample" , "toolbox/ident/idutils/"; + "idsim" , "toolbox/ident/ident/"; + "idsim" , "toolbox/ident/idobsolete/"; + "idsimsd" , "toolbox/ident/idobsolete/"; + "idsimsd" , "toolbox/ident/ident/"; + "idst" , "toolbox/pde/"; + "idstrip" , "toolbox/ident/idguis/"; + "idtscale" , "toolbox/ident/idutils/"; + "iduiarx" , "toolbox/ident/idguis/"; + "iduiaxes" , "toolbox/ident/idguis/"; + "iduiaxis" , "toolbox/ident/idguis/"; + "iduibn" , "toolbox/ident/idguis/"; + "iduicalc" , "toolbox/ident/idguis/"; + "iduiclpw" , "toolbox/ident/idguis/"; + "iduiconf" , "toolbox/ident/idguis/"; + "iduicra" , "toolbox/ident/idguis/"; + "iduidemo" , "toolbox/ident/idguis/"; + "iduidrop" , "toolbox/ident/idguis/"; + "iduiedit" , "toolbox/ident/idguis/"; + "iduiexp" , "toolbox/ident/idguis/"; + "iduifile" , "toolbox/ident/idguis/"; + "iduifilt" , "toolbox/ident/idguis/"; + "iduifoc" , "toolbox/ident/idguis/"; + "iduigco" , "toolbox/ident/idguis/"; + "iduigetd" , "toolbox/ident/idguis/"; + "iduigetp" , "toolbox/ident/idguis/"; + "iduihelp" , "toolbox/ident/idguis/"; + "iduiinfo" , "toolbox/ident/idguis/"; + "iduiinsd" , "toolbox/ident/idguis/"; + "iduiinsm" , "toolbox/ident/idguis/"; + "iduiio" , "toolbox/ident/idguis/"; + "iduiiono" , "toolbox/ident/idguis/"; + "iduiiter" , "toolbox/ident/idguis/"; + "iduikeyp" , "toolbox/ident/idguis/"; + "iduilay" , "toolbox/ident/idguis/"; + "iduilay1" , "toolbox/ident/idguis/"; + "iduilay2" , "toolbox/ident/idguis/"; + "iduimbcb" , "toolbox/ident/idguis/"; + "iduimod" , "toolbox/ident/idguis/"; + "iduims" , "toolbox/ident/idguis/"; + "iduinpar" , "toolbox/ident/idguis/"; + "iduiopt" , "toolbox/ident/idguis/"; + "iduipoin" , "toolbox/ident/idguis/"; + "iduipop" , "toolbox/ident/idguis/"; + "iduipw" , "toolbox/ident/idguis/"; + "iduiqs" , "toolbox/ident/idguis/"; + "iduisel" , "toolbox/ident/idguis/"; + "iduisess" , "toolbox/ident/idguis/"; + "iduispa" , "toolbox/ident/idguis/"; + "iduiss" , "toolbox/ident/idguis/"; + "iduistat" , "toolbox/ident/idguis/"; + "iduital" , "toolbox/ident/idguis/"; + "iduitrf" , "toolbox/ident/idguis/"; + "iduivis" , "toolbox/ident/idguis/"; + "iduiwast" , "toolbox/ident/idguis/"; + "iduiwok" , "toolbox/ident/idguis/"; + "idummy" , "toolbox/stats/private/"; + "idunlink" , "toolbox/ident/idguis/"; + "idvmenus" , "toolbox/ident/idguis/"; + "idwb" , "toolbox/ident/idutils/"; + "ifanbeam" , "toolbox/images/images/"; + "iirchk" , "toolbox/signal/signal/private/"; + "im2bw" , "toolbox/images/images/"; + "im2col" , "toolbox/images/images/"; + "im2double" , "toolbox/images/images/"; + "im2java2d" , "toolbox/images/images/"; + "im2mis" , "toolbox/stats/private/"; + "im2mis" , "toolbox/images/images/"; + "im2uint16" , "toolbox/images/images/"; + "im2uint8" , "toolbox/images/images/"; + "imabsdiff" , "toolbox/images/images/"; + "imadd" , "toolbox/images/images/"; + "imadjdemo" , "toolbox/images/imdemos/"; + "imadjust" , "toolbox/images/images/"; + "imapprox" , "toolbox/images/images/"; + "imargin" , "toolbox/control/control/"; + "imbothat" , "toolbox/images/images/"; + "imclearborder" , "toolbox/images/images/"; + "imclose" , "toolbox/images/images/"; + "imcomplement" , "toolbox/images/images/"; + "imcontour" , "toolbox/images/images/"; + "imcrop" , "toolbox/images/images/"; + "imdilate" , "toolbox/images/images/"; + "imdivide" , "toolbox/images/images/"; + "imerode" , "toolbox/images/images/"; + "imextendedmax" , "toolbox/images/images/"; + "imextendedmin" , "toolbox/images/images/"; + "imfeature" , "toolbox/images/images/"; + "imfill" , "toolbox/images/images/"; + "imfilter" , "toolbox/images/images/"; + "imhist" , "toolbox/images/images/"; + "imhistc" , "toolbox/images/images/private/"; + "imhmax" , "toolbox/images/images/"; + "imhmin" , "toolbox/images/images/"; + "imimposemin" , "toolbox/images/images/"; + "imlincomb" , "toolbox/images/images/"; + "immovie" , "toolbox/images/images/"; + "immultiply" , "toolbox/images/images/"; + "imnoise" , "toolbox/images/images/"; + "imopen" , "toolbox/images/images/"; + "imp2ss" , "toolbox/robust/"; + "impinvar" , "toolbox/signal/signal/"; + "impixel" , "toolbox/images/images/"; + "importfcn" , "toolbox/control/ctrlguis/"; + "importfilt" , "toolbox/signal/sptoolgui/private/"; + "importsig" , "toolbox/signal/sptoolgui/private/"; + "importspec" , "toolbox/signal/sptoolgui/private/"; + "improfile" , "toolbox/images/images/"; + "impulse" , "toolbox/control/control/"; + "impz" , "toolbox/signal/signal/"; + "impzlength" , "toolbox/signal/signal/"; + "imreconstruct" , "toolbox/images/images/"; + "imregionalmax" , "toolbox/images/images/"; + "imregionalmin" , "toolbox/images/images/"; + "imresize" , "toolbox/images/images/"; + "imrotate" , "toolbox/images/images/"; + "imshow" , "toolbox/images/images/"; + "imslice" , "toolbox/images/images/"; + "imsubtract" , "toolbox/images/images/"; + "imtophat" , "toolbox/images/images/"; + "imtransform" , "toolbox/images/images/"; + "imuigeom" , "toolbox/images/imdemos/private/"; + "imview" , "toolbox/images/images/"; + "imviewhelp" , "toolbox/images/images/private/"; + "imzoom" , "toolbox/images/images/"; + "inbounds" , "toolbox/signal/sptoolgui/private/"; + "inconsistent" , "toolbox/stats/"; + "increment_name" , "toolbox/stateflow/stateflow/private/"; + "ind2gray" , "toolbox/images/images/"; + "indmatch" , "toolbox/ident/idutils/"; + "inductor" , "toolbox/control/ctrldemos/private/"; + "infline" , "toolbox/control/ctrlguis/"; + "info2mask" , "toolbox/signal/sigtools/"; + "infomatman" , "toolbox/stateflow/stateflow/private/"; + "inherit" , "toolbox/ident/idutils/"; + "init_html_renderer" , "toolbox/stateflow/stateflow/private/"; + "initial" , "toolbox/control/control/"; + "initialUpper" , "toolbox/simulink/simulink/private/"; + "initialize_data_information" , "toolbox/stateflow/coder/private/"; + "initmesh" , "toolbox/pde/"; + "initopspec" , "toolbox/shared/slcontrollib/"; + "initprefs" , "toolbox/local/"; + "initsim" , "toolbox/stateflow/sfdemos/"; + "initsysresp" , "toolbox/control/ctrlguis/"; + "inpd2nk" , "toolbox/ident/idutils/"; + "insert_dsp_includes" , "toolbox/stateflow/coder/private/"; + "insertfdtbxhelp" , "toolbox/signal/sigtools/private/"; + "interc" , "toolbox/robust/"; + "interp" , "toolbox/signal/signal/"; + "interspace" , "toolbox/signal/sigtools/"; + "intfilt" , "toolbox/signal/signal/"; + "intline" , "toolbox/images/images/private/"; + "invfreqs" , "toolbox/signal/signal/"; + "invfreqz" , "toolbox/signal/signal/"; + "invsinc" , "toolbox/signal/signal/private/"; + "iofc" , "toolbox/robust/"; + "iofr" , "toolbox/robust/"; + "ipex001" , "toolbox/images/imdemos/"; + "ipex002" , "toolbox/images/imdemos/"; + "ipex003" , "toolbox/images/imdemos/"; + "ipex004" , "toolbox/images/imdemos/"; + "ipex005" , "toolbox/images/imdemos/"; + "ipex006" , "toolbox/images/imdemos/"; + "ipexangle" , "toolbox/images/imdemos/"; + "ipexcontrast" , "toolbox/images/imdemos/"; + "ipexfabric" , "toolbox/images/imdemos/"; + "ipexhistology" , "toolbox/images/imdemos/"; + "ipexlanstretch" , "toolbox/images/imdemos/"; + "ipexpendulum" , "toolbox/images/imdemos/"; + "ipexradius" , "toolbox/images/imdemos/"; + "ipexreconstruct" , "toolbox/images/imdemos/"; + "ipexregularized" , "toolbox/images/imdemos/"; + "ipexrice" , "toolbox/images/imdemos/"; + "ipexrotate" , "toolbox/images/imdemos/"; + "ipexroundness" , "toolbox/images/imdemos/"; + "ipexsnow" , "toolbox/images/imdemos/"; + "ipexwatershed" , "toolbox/images/imdemos/"; + "ippl" , "toolbox/images/images/"; + "iptdemos" , "toolbox/images/imdemos/"; + "iptgate" , "toolbox/images/images/"; + "iptgetpref" , "toolbox/images/images/"; + "iptprefs" , "toolbox/images/images/private/"; + "iptregistry" , "toolbox/images/images/private/"; + "iptsetpref" , "toolbox/images/images/"; + "iqr" , "toolbox/stats/"; + "iradon" , "toolbox/images/images/"; + "is2rc" , "toolbox/signal/signal/"; + "isModelClosed" , "toolbox/simulink/simulink/private/"; + "isNCDStruct" , "toolbox/sloptim/sloptobsolete/"; + "is_chart_input_data" , "toolbox/stateflow/coder/private/"; + "is_chart_output_data" , "toolbox/stateflow/coder/private/"; + "is_eml_block" , "toolbox/simulink/simulink/"; + "is_eml_chart" , "toolbox/stateflow/stateflow/private/"; + "is_eml_fcn" , "toolbox/stateflow/stateflow/private/"; + "is_eml_script" , "toolbox/stateflow/stateflow/private/"; + "is_enum_property" , "toolbox/stateflow/stateflow/private/"; + "is_ert_multi_instance" , "toolbox/stateflow/coder/private/"; + "is_object_editable" , "toolbox/stateflow/stateflow/private/"; + "is_sf_chart" , "toolbox/stateflow/stateflow/private/"; + "is_sf_chart_block" , "toolbox/stateflow/stateflow/private/"; + "is_sf_fixpt_autoscale" , "toolbox/simulink/fixedandfloat/"; + "is_sf_machine" , "toolbox/stateflow/stateflow/private/"; + "is_simulink_handle" , "toolbox/simulink/simulink/"; + "is_truth_table_chart" , "toolbox/stateflow/stateflow/private/"; + "is_truth_table_fcn" , "toolbox/stateflow/stateflow/private/"; + "isbw" , "toolbox/images/images/"; + "iscatter" , "toolbox/stats/"; + "iscolor" , "toolbox/signal/sptoolgui/private/"; + "isconfigurable" , "toolbox/simulink/components/private/"; + "iscontinuous" , "toolbox/simulink/components/private/"; + "iscpstruct" , "toolbox/images/images/private/"; + "iscvar" , "toolbox/simulink/simulink/"; + "isdynpropenab" , "toolbox/signal/sigtools/"; + "iseuclidean" , "toolbox/stats/private/"; + "isfdt" , "toolbox/signal/sptoolgui/private/"; + "isfdtbxinstalled" , "toolbox/signal/sigtools/"; + "isfixptinstalled" , "toolbox/signal/sigtools/"; + "isgray" , "toolbox/images/images/"; + "isinaxes" , "toolbox/stats/private/"; + "isind" , "toolbox/images/images/"; + "ispc" , "toolbox/stateflow/stateflow/private/"; + "isresampler" , "toolbox/images/images/private/"; + "isreserved" , "toolbox/signal/sigtools/"; + "isrgb" , "toolbox/images/images/"; + "issame" , "toolbox/robust/"; + "issystem" , "toolbox/robust/"; + "istform" , "toolbox/images/images/private/"; + "isthss" , "toolbox/ident/idobsolete/"; + "istito" , "toolbox/robust/private/"; + "istree" , "toolbox/robust/"; + "isvalidvar" , "toolbox/signal/sptoolgui/private/"; + "iv" , "toolbox/ident/ident/"; + "iv4" , "toolbox/ident/ident/"; + "ivar" , "toolbox/ident/ident/"; + "ivstruc" , "toolbox/ident/ident/"; + "ivx" , "toolbox/ident/ident/"; + "iwishrnd" , "toolbox/stats/"; + "jacColumnErr" , "toolbox/optim/private/"; + "jacobian2ss" , "toolbox/slcontrol/slctrlutil/"; + "javaDAClipboard" , "toolbox/shared/dastudio/"; + "javaSimulinkRoot" , "toolbox/shared/dastudio/"; + "javaWorkspace" , "toolbox/shared/dastudio/"; + "jbtest" , "toolbox/stats/"; + "jetdemo" , "toolbox/control/ctrldemos/"; + "jigglemesh" , "toolbox/pde/"; + "joinCellToStr" , "toolbox/simulink/simulink/private/"; + "jordan" , "toolbox/symbolic/"; + "josedemo" , "toolbox/robust/"; + "junctddg" , "toolbox/stateflow/stateflow/private/"; + "junctdlg" , "toolbox/stateflow/stateflow/private/"; + "justzoom" , "toolbox/signal/sptoolgui/private/"; + "kaiser" , "toolbox/signal/signal/"; + "kaiserord" , "toolbox/signal/signal/"; + "kalmdemo" , "toolbox/control/ctrldemos/"; + "kdtree" , "toolbox/images/images/private/"; + "kmeans" , "toolbox/stats/"; + "knt2brk" , "toolbox/splines/"; + "knt2mlt" , "toolbox/splines/"; + "kratio" , "toolbox/signal/signal/"; + "kruskalwallis" , "toolbox/stats/"; + "ksdensity" , "toolbox/stats/"; + "kstest" , "toolbox/stats/"; + "kstest2" , "toolbox/stats/"; + "kurtosis" , "toolbox/stats/"; + "lab2double" , "toolbox/images/images/"; + "lab2lch" , "toolbox/images/images/private/"; + "lab2str" , "toolbox/control/ctrlobsolete/"; + "lab2uint16" , "toolbox/images/images/"; + "lab2uint8" , "toolbox/images/images/"; + "lab2xyz" , "toolbox/images/images/private/"; + "label" , "toolbox/simulink/simulink/private/"; + "label2rgb" , "toolbox/images/images/"; + "labelacc" , "toolbox/robust/"; + "labelstr" , "toolbox/stateflow/stateflow/private/"; + "lambertw" , "toolbox/symbolic/"; + "landsatdemo" , "toolbox/images/imdemos/"; + "lar2rc" , "toolbox/signal/signal/"; + "largestuiwidth" , "toolbox/signal/sigtools/"; + "latc2tf" , "toolbox/signal/signal/"; + "latcfilt" , "toolbox/signal/signal/"; + "launchfv" , "toolbox/signal/sigtools/"; + "layout_disc_window" , "toolbox/simulink/components/"; + "lch2lab" , "toolbox/images/images/private/"; + "lclfminbnd" , "toolbox/signal/signal/private/"; + "levdown" , "toolbox/signal/signal/private/"; + "leverage" , "toolbox/stats/"; + "levinson" , "toolbox/signal/signal/"; + "levup" , "toolbox/signal/signal/private/"; + "lfdata" , "toolbox/signal/sptoolgui/private/"; + "lftf" , "toolbox/robust/"; + "lhsdesign" , "toolbox/stats/"; + "lhsnorm" , "toolbox/stats/"; + "libbrowse" , "toolbox/simulink/simulink/"; + "libinfo" , "toolbox/simulink/simulink/"; + "libintro" , "toolbox/simulink/simdemos/"; + "license" , "toolbox/local/"; + "lillietest" , "toolbox/stats/"; + "limintm" , "toolbox/simulink/blocks/"; + "lineSearch" , "toolbox/optim/private/"; + "linearize" , "toolbox/slcontrol/slcontrol/"; + "linedir" , "toolbox/simulink/simulink/private/"; + "lineext" , "toolbox/simulink/simulink/private/"; + "linemima" , "toolbox/simulink/simulink/private/"; + "linetip" , "toolbox/shared/controllib/"; + "linevent" , "toolbox/slcontrol/slcontrol/"; + "linf" , "toolbox/robust/"; + "linfdemo" , "toolbox/robust/"; + "linio" , "toolbox/slcontrol/slcontrol/"; + "linkage" , "toolbox/stats/"; + "linmod" , "toolbox/simulink/simulink/"; + "linmod2" , "toolbox/simulink/simulink/"; + "linmodsupported" , "toolbox/simulink/simulink/private/"; + "linmodv5" , "toolbox/simulink/simulink/"; + "linoptions" , "toolbox/slcontrol/slcontrol/"; + "linprog" , "toolbox/optim/"; + "linsetup" , "toolbox/simulink/blocks/"; + "linsim" , "toolbox/simulink/simulink/"; + "linsub" , "toolbox/control/ctrlutil/"; + "linterp" , "toolbox/robust/"; + "lipsol" , "toolbox/optim/private/"; + "listModels" , "toolbox/shared/dastudio/"; + "lnkfvtool2mask" , "toolbox/signal/sigtools/"; + "load_model" , "toolbox/simulink/simulink/private/"; + "load_simulink" , "toolbox/simulink/simulink/"; + "load_system" , "toolbox/simulink/simulink/"; + "local_max" , "toolbox/signal/signal/private/"; + "locateFileInPath" , "toolbox/simulink/simulink/private/"; + "log_file_manager" , "toolbox/stateflow/stateflow/private/"; + "logcfg" , "toolbox/simulink/simulink/"; + "logctrlpanel" , "toolbox/simulink/simulink/"; + "logical2string" , "toolbox/signal/sigtools/"; + "logncdf" , "toolbox/stats/"; + "lognfit" , "toolbox/stats/"; + "logninv" , "toolbox/stats/"; + "lognlike" , "toolbox/stats/"; + "lognpdf" , "toolbox/stats/"; + "lognrnd" , "toolbox/stats/"; + "lognstat" , "toolbox/stats/"; + "logpanel" , "toolbox/simulink/simulink/"; + "look1_func_approx" , "toolbox/simulink/blocks/private/"; + "look1_func_plot" , "toolbox/simulink/blocks/private/"; + "look_for_corrupted_models" , "toolbox/stateflow/stateflow/private/"; + "lookundermask" , "toolbox/simulink/simulink/"; + "lookup1dddg" , "toolbox/simulink/blocks/"; + "lookup2dddg" , "toolbox/simulink/blocks/"; + "loopstruct" , "toolbox/control/ctrlguis/"; + "lorenzi" , "toolbox/simulink/dee/"; + "lowpass" , "toolbox/signal/signal/private/"; + "lp2bp" , "toolbox/signal/signal/"; + "lp2bs" , "toolbox/signal/signal/"; + "lp2hp" , "toolbox/signal/signal/"; + "lp2lp" , "toolbox/signal/signal/"; + "lpc" , "toolbox/signal/signal/"; + "lpc-ardemo" , "toolbox/signal/sigdemos/"; + "lproject" , "toolbox/control/ctrlguis/"; + "lqe" , "toolbox/control/ctrlobsolete/"; + "lqe2" , "toolbox/control/ctrlobsolete/"; + "lqed" , "toolbox/control/ctrlobsolete/"; + "lqew" , "toolbox/control/ctrlobsolete/"; + "lqg" , "toolbox/robust/"; + "lqr" , "toolbox/control/control/"; + "lqr2" , "toolbox/control/ctrlobsolete/"; + "lqrc" , "toolbox/robust/"; + "lqrd" , "toolbox/control/control/"; + "lqrdes" , "toolbox/control/ctrldemos/"; + "lqry" , "toolbox/control/control/"; + "lrscale" , "toolbox/control/ctrlutil/"; + "lsf2poly" , "toolbox/signal/signal/"; + "lshapeb" , "toolbox/pde/"; + "lshapec" , "toolbox/pde/"; + "lshapeg" , "toolbox/pde/"; + "lsim" , "toolbox/control/control/"; + "lsline" , "toolbox/stats/"; + "lsqcurvefit" , "toolbox/optim/"; + "lsqfcnchk" , "toolbox/optim/private/"; + "lsqisotonic" , "toolbox/stats/private/"; + "lsqlin" , "toolbox/optim/"; + "lsqncommon" , "toolbox/optim/private/"; + "lsqnonlin" , "toolbox/optim/"; + "lticharmenu" , "toolbox/control/ctrlguis/"; + "ltidemo" , "toolbox/control/ctrldemos/"; + "ltifr" , "toolbox/control/control/"; + "ltimask" , "toolbox/control/control/"; + "ltimodels" , "toolbox/control/control/"; + "ltiplot" , "toolbox/control/ctrlguis/"; + "ltiplotmenu" , "toolbox/control/ctrlguis/"; + "ltiplottypes" , "toolbox/control/ctrlguis/"; + "ltiprops" , "toolbox/control/control/"; + "ltitipmenus" , "toolbox/shared/controllib/"; + "ltitr" , "toolbox/control/control/"; + "ltiview" , "toolbox/control/control/"; + "ltk2" , "toolbox/ident/idutils/private/"; + "ltrdata1" , "toolbox/robust/"; + "ltrdata2" , "toolbox/robust/"; + "ltrdemo" , "toolbox/robust/"; + "ltrdes1" , "toolbox/robust/"; + "ltrdes2" , "toolbox/robust/"; + "ltru" , "toolbox/robust/"; + "ltry" , "toolbox/robust/"; + "lutbridge" , "toolbox/images/images/private/"; + "lutclean" , "toolbox/images/images/private/"; + "lutdiag" , "toolbox/images/images/private/"; + "lutdilate" , "toolbox/images/images/private/"; + "luteditorddg_cb" , "toolbox/simulink/blocks/"; + "luterode" , "toolbox/images/images/private/"; + "lutfatten" , "toolbox/images/images/private/"; + "lutfill" , "toolbox/images/images/private/"; + "luthbreak" , "toolbox/images/images/private/"; + "lutiso" , "toolbox/images/images/private/"; + "lutmajority" , "toolbox/images/images/private/"; + "lutper4" , "toolbox/images/images/private/"; + "lutper8" , "toolbox/images/images/private/"; + "lutremove" , "toolbox/images/images/private/"; + "lutshrink" , "toolbox/images/images/private/"; + "lutsingle" , "toolbox/images/images/private/"; + "lutskel1" , "toolbox/images/images/private/"; + "lutskel2" , "toolbox/images/images/private/"; + "lutskel3" , "toolbox/images/images/private/"; + "lutskel4" , "toolbox/images/images/private/"; + "lutskel5" , "toolbox/images/images/private/"; + "lutskel6" , "toolbox/images/images/private/"; + "lutskel7" , "toolbox/images/images/private/"; + "lutskel8" , "toolbox/images/images/private/"; + "lutspur" , "toolbox/images/images/private/"; + "lutthin1" , "toolbox/images/images/private/"; + "lutthin2" , "toolbox/images/images/private/"; + "lutthin3" , "toolbox/images/images/private/"; + "lutthin4" , "toolbox/images/images/private/"; + "lyap" , "toolbox/control/control/"; + "lyap2" , "toolbox/control/ctrlobsolete/"; + "lyapchol" , "toolbox/control/control/"; + "lyapkr" , "toolbox/robust/"; + "machine2model" , "toolbox/stateflow/stateflow/private/"; + "machine_bind_sflinks" , "toolbox/stateflow/stateflow/private/"; + "machine_shallow_find" , "toolbox/stateflow/stateflow/private/"; + "machineddg" , "toolbox/stateflow/stateflow/private/"; + "machinedlg" , "toolbox/stateflow/stateflow/private/"; + "mad" , "toolbox/stats/"; + "mag2dB" , "toolbox/control/ctrlutil/"; + "magballdat" , "toolbox/slcontrol/slctrldemos/"; + "magballinit" , "toolbox/slcontrol/slctrldemos/"; + "mahal" , "toolbox/stats/"; + "make_ansi_tfl" , "toolbox/simulink/simulink/"; + "make_ecoder_hook" , "toolbox/rtw/rtw/"; + "make_formatters" , "toolbox/simulink/simcoverage/private/"; + "make_gnu_tfl" , "toolbox/simulink/simulink/"; + "make_iso_tfl" , "toolbox/simulink/simulink/"; + "make_rtw" , "toolbox/rtw/rtw/"; + "make_targetfcnlib_mat_files" , "toolbox/simulink/simulink/"; + "make_tlc_only" , "toolbox/rtw/rtw/"; + "makecform" , "toolbox/images/images/"; + "makelut" , "toolbox/images/images/"; + "makeresampler" , "toolbox/images/images/"; + "maketform" , "toolbox/images/images/"; + "makeuniqcellstrs" , "toolbox/signal/sigtools/"; + "manova1" , "toolbox/stats/"; + "manovacluster" , "toolbox/stats/"; + "manswitch" , "toolbox/simulink/blocks/"; + "maple" , "toolbox/symbolic/"; + "mapleinit" , "toolbox/symbolic/"; + "maplemex" , "toolbox/symbolic/"; + "margin" , "toolbox/control/control/"; + "margindemo" , "toolbox/control/ctrldemos/"; + "margindemo_sls" , "toolbox/control/ctrldemos/"; + "maskedit" , "toolbox/simulink/simulink/"; + "maskpopups" , "toolbox/simulink/simulink/"; + "masksync" , "toolbox/simulink/simulink/private/"; + "masspg" , "toolbox/simulink/dee/"; + "masspgi" , "toolbox/simulink/dee/"; + "mat2gray" , "toolbox/images/images/"; + "matchlsq" , "toolbox/control/ctrlguis/"; + "matq2ws" , "toolbox/pde/private/"; + "matqdlg" , "toolbox/pde/private/"; + "matqparse" , "toolbox/pde/private/"; + "matqueue" , "toolbox/pde/private/"; + "matrxcatmask" , "toolbox/simulink/blocks/"; + "maxflat" , "toolbox/signal/signal/"; + "mcodeutils" , "toolbox/signal/sigtools/"; + "md2c" , "toolbox/ident/idutils/"; + "mdlRefDepsComment" , "toolbox/simulink/simulink/private/"; + "mdldisc_demo" , "toolbox/simulink/simdemos/simfeatures/"; + "mdlref_basicscript" , "toolbox/simulink/simdemos/simfeatures/mdlref/"; + "mdlref_busscript" , "toolbox/simulink/simdemos/simfeatures/mdlref/"; + "mdlref_conversionscript" , "toolbox/simulink/simdemos/simfeatures/mdlref/"; + "mdlref_depgraph_demo" , "toolbox/simulink/simdemos/simfeatures/mdlref/"; + "mdlref_paramargsscript" , "toolbox/simulink/simdemos/simfeatures/mdlref/"; + "mdlrefddg_cb" , "toolbox/simulink/simulink/"; + "mdscale" , "toolbox/stats/"; + "mdscaledemo" , "toolbox/stats/"; + "mean2" , "toolbox/images/images/"; + "meansgraph" , "toolbox/stats/"; + "medfilt1" , "toolbox/signal/signal/"; + "medfilt2" , "toolbox/images/images/"; + "merge" , "toolbox/signal/sptoolgui/private/"; + "mergedemoscript" , "toolbox/simulink/simdemos/simfeatures/"; + "mergefcn" , "toolbox/simulink/simdemos/simfeatures/"; + "mex_setup" , "toolbox/stateflow/stateflow/private/"; + "mex_sfun_user_fxp_examples" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "mf2th" , "toolbox/ident/idobsolete/"; + "mfun" , "toolbox/symbolic/"; + "mfunlist" , "toolbox/symbolic/"; + "mgrp2idx" , "toolbox/stats/private/"; + "mhelp" , "toolbox/symbolic/"; + "midprefs" , "toolbox/ident/idguis/"; + "milldemo" , "toolbox/control/ctrldemos/"; + "milldemo_sls" , "toolbox/control/ctrldemos/"; + "mimofr" , "toolbox/control/control/"; + "min4termwin" , "toolbox/signal/signal/private/"; + "miniplot" , "toolbox/control/ctrlobsolete/"; + "minlin" , "toolbox/simulink/simulink/"; + "minloop" , "toolbox/ident/idutils/"; + "minreal" , "toolbox/control/control/"; + "misdata" , "toolbox/ident/ident/"; + "mixedalg" , "toolbox/robust/"; + "mixedm" , "toolbox/simulink/blocks/"; + "mkargs" , "toolbox/robust/"; + "mkargs1" , "toolbox/robust/"; + "mkargs5x" , "toolbox/robust/"; + "mkconstarray" , "toolbox/images/images/private/"; + "mklti" , "toolbox/robust/private/"; + "mksys" , "toolbox/robust/"; + "mktito" , "toolbox/robust/private/"; + "ml_type" , "toolbox/stateflow/stateflow/private/"; + "mle" , "toolbox/stats/"; + "mlecov" , "toolbox/stats/"; + "mlecustom" , "toolbox/stats/private/"; + "mlscript_ui" , "toolbox/simulink/simulink/"; + "mltrdemo" , "toolbox/robust/"; + "mmole" , "toolbox/optim/"; + "moddemo" , "toolbox/signal/sigdemos/"; + "model2machine" , "toolbox/shared/dastudio/"; + "modeladvisor" , "toolbox/simulink/simulink/"; + "modelassistant" , "toolbox/simulink/simulink/"; + "modelddg" , "toolbox/simulink/simulink/"; + "modelddg_file_cb" , "toolbox/simulink/simulink/"; + "modelddg_readOnly_cb" , "toolbox/simulink/simulink/"; + "modeldeps" , "toolbox/simulink/simulink/private/"; + "modelref_conversion_bus_utils" , "toolbox/simulink/simulink/private/"; + "modelref_conversion_utilities" , "toolbox/simulink/simulink/private/"; + "modelrefsiglog" , "toolbox/simulink/simulink/"; + "modelrefsim_default_tmf" , "toolbox/rtw/rtw/"; + "modreal" , "toolbox/robust/"; + "modred" , "toolbox/control/control/"; + "modstruc" , "toolbox/ident/idutils/"; + "modulate" , "toolbox/signal/signal/"; + "molecule" , "toolbox/optim/"; + "moment" , "toolbox/stats/"; + "montage" , "toolbox/images/images/"; + "morphop" , "toolbox/images/images/private/"; + "motor" , "toolbox/ident/ident/"; + "movemask" , "toolbox/simulink/simulink/"; + "moveptr" , "toolbox/control/ctrlguis/"; + "mpt_get_data_types" , "toolbox/simulink/simulink/"; + "mrdemo" , "toolbox/robust/"; + "mrgfocus" , "toolbox/control/ctrlutil/"; + "mrgios" , "toolbox/control/ctrlguis/"; + "mroots" , "toolbox/control/ctrlutil/"; + "ms2th" , "toolbox/ident/idobsolete/"; + "mscohere" , "toolbox/signal/signal/"; + "msearch" , "toolbox/ident/idutils/"; + "msfuntmpl" , "toolbox/simulink/blocks/"; + "mskeddlg" , "toolbox/simulink/simulink/"; + "mskedpg" , "toolbox/simulink/simulink/private/"; + "mu2lti" , "toolbox/robust/private/"; + "mudemo" , "toolbox/robust/"; + "mudemo1" , "toolbox/robust/"; + "mueva" , "toolbox/robust/"; + "mulerr" , "toolbox/robust/"; + "mulresp" , "toolbox/control/ctrlobsolete/"; + "multcompare" , "toolbox/stats/"; + "multiband" , "toolbox/signal/signal/private/"; + "multidat" , "toolbox/simulink/simdemos/"; + "muopt" , "toolbox/robust/"; + "muoptold" , "toolbox/robust/"; + "muplt" , "toolbox/robust/"; + "music" , "toolbox/signal/signal/private/"; + "musldemo" , "toolbox/robust/"; + "musol4" , "toolbox/robust/"; + "musyn" , "toolbox/robust/"; + "muxwidths" , "toolbox/stateflow/stateflow/private/"; + "mvnpdf" , "toolbox/stats/"; + "mvnrnd" , "toolbox/stats/"; + "mvplotdemo" , "toolbox/stats/"; + "mvtrnd" , "toolbox/stats/"; + "mx2str" , "toolbox/stateflow/stateflow/private/"; + "n4sid" , "toolbox/ident/ident/"; + "n4sid_f" , "toolbox/ident/ident/"; + "nanmax" , "toolbox/stats/"; + "nanmean" , "toolbox/stats/"; + "nanmedian" , "toolbox/stats/"; + "nanmin" , "toolbox/stats/"; + "nanstd" , "toolbox/stats/"; + "nanstruc" , "toolbox/ident/idutils/"; + "nansum" , "toolbox/stats/"; + "nanvar" , "toolbox/stats/"; + "nbincdf" , "toolbox/stats/"; + "nbinfit" , "toolbox/stats/"; + "nbininv" , "toolbox/stats/"; + "nbinlike" , "toolbox/stats/"; + "nbinpdf" , "toolbox/stats/"; + "nbinrnd" , "toolbox/stats/"; + "nbinstat" , "toolbox/stats/"; + "ncdglob" , "toolbox/sloptim/sloptobsolete/"; + "ncdupdate" , "toolbox/sloptim/sloptobsolete/"; + "ncfcdf" , "toolbox/stats/"; + "ncfinv" , "toolbox/stats/"; + "ncfpdf" , "toolbox/stats/"; + "ncfrnd" , "toolbox/stats/"; + "ncfstat" , "toolbox/stats/"; + "nctcdf" , "toolbox/stats/"; + "nctinv" , "toolbox/stats/"; + "nctpdf" , "toolbox/stats/"; + "nctrnd" , "toolbox/stats/"; + "nctstat" , "toolbox/stats/"; + "ncx2cdf" , "toolbox/stats/"; + "ncx2inv" , "toolbox/stats/"; + "ncx2pdf" , "toolbox/stats/"; + "ncx2rnd" , "toolbox/stats/"; + "ncx2stat" , "toolbox/stats/"; + "nddirectico" , "toolbox/simulink/blocks/"; + "ndlookico" , "toolbox/simulink/blocks/"; + "new_data" , "toolbox/stateflow/stateflow/private/"; + "new_event" , "toolbox/stateflow/stateflow/private/"; + "new_rtw_interface_marker" , "toolbox/stateflow/coder/private/"; + "new_state_output_data" , "toolbox/stateflow/stateflow/private/"; + "new_system" , "toolbox/simulink/simulink/"; + "new_target" , "toolbox/stateflow/stateflow/private/"; + "newknt" , "toolbox/splines/"; + "newsro" , "toolbox/sloptim/sloptim/"; + "nextcolor" , "toolbox/signal/sptoolgui/private/"; + "ngrid" , "toolbox/control/control/"; + "nicchart" , "toolbox/control/ctrlguis/"; + "nice_shot" , "toolbox/stateflow/stateflow/private/"; + "nichols" , "toolbox/control/control/"; + "niclims" , "toolbox/control/ctrlguis/"; + "nlconst" , "toolbox/optim/private/"; + "nlconst" , "toolbox/simulink/simulink/private/"; + "nlfilter" , "toolbox/images/images/"; + "nlinfit" , "toolbox/stats/"; + "nlinopt" , "toolbox/sloptim/sloptobsolete/"; + "nlintool" , "toolbox/stats/"; + "nlparci" , "toolbox/stats/"; + "nlpredci" , "toolbox/stats/"; + "nls3" , "toolbox/optim/"; + "nlsf1" , "toolbox/optim/"; + "nlsf1a" , "toolbox/optim/"; + "nlsf3a" , "toolbox/optim/"; + "nlsmm3" , "toolbox/optim/"; + "nlsq" , "toolbox/optim/private/"; + "nnsearch" , "toolbox/images/images/private/"; + "noiprefi" , "toolbox/ident/idutils/"; + "non_empty_subcharts_in" , "toolbox/stateflow/stateflow/private/"; + "normcdf" , "toolbox/stats/"; + "normfit" , "toolbox/stats/"; + "normh2" , "toolbox/robust/"; + "normhinf" , "toolbox/robust/"; + "norminv" , "toolbox/stats/"; + "normlike" , "toolbox/stats/"; + "normpdf" , "toolbox/stats/"; + "normplot" , "toolbox/stats/"; + "normrnd" , "toolbox/stats/"; + "normspec" , "toolbox/stats/"; + "normstat" , "toolbox/stats/"; + "normxcorr2" , "toolbox/images/images/"; + "notbool" , "toolbox/simulink/simulink/private/"; + "notchdemo" , "toolbox/control/ctrldemos/"; + "notchdemo_sls" , "toolbox/control/ctrldemos/"; + "nrfiltdemo" , "toolbox/images/imdemos/"; + "ntsc2rgb" , "toolbox/images/images/"; + "nuderst" , "toolbox/ident/idutils/"; + "num2fix" , "toolbox/simulink/fixedandfloat/"; + "num2fixpt" , "toolbox/simulink/fixedandfloat/"; + "num2ordinal" , "toolbox/images/images/private/"; + "numdemo" , "toolbox/control/ctrldemos/"; + "numerictypeddg" , "toolbox/simulink/simulink/"; + "nuttallwin" , "toolbox/signal/signal/"; + "nyqaux" , "toolbox/ident/idutils/"; + "nyqchart" , "toolbox/control/ctrlguis/"; + "nyqplot" , "toolbox/ident/idobsolete/"; + "nyquist" , "toolbox/control/control/"; + "obalreal" , "toolbox/robust/"; + "object_limits" , "toolbox/stateflow/stateflow/private/"; + "objfun" , "toolbox/optim/"; + "objfungrad" , "toolbox/optim/"; + "obsv" , "toolbox/control/control/"; + "obsvf" , "toolbox/control/control/"; + "oe" , "toolbox/ident/ident/"; + "oestab" , "toolbox/ident/idutils/"; + "officeassign" , "toolbox/optim/"; + "ohkapp" , "toolbox/robust/"; + "ohkdemo" , "toolbox/robust/"; + "ohklmr" , "toolbox/robust/"; + "on2off" , "toolbox/stats/private/"; + "onoff" , "toolbox/simulink/simulink/private/"; + "onoffdemocontrol" , "toolbox/simulink/simdemos/aerospace/"; + "opamp" , "toolbox/control/ctrldemos/private/"; + "opampdemo" , "toolbox/control/ctrldemos/"; + "opampdemo_aux" , "toolbox/control/ctrldemos/"; + "open_system" , "toolbox/simulink/simulink/"; + "open_target_dialog" , "toolbox/stateflow/sfdemos/"; + "operpoint" , "toolbox/shared/slcontrollib/"; + "operspec" , "toolbox/shared/slcontrollib/"; + "optblock" , "toolbox/sloptim/sloptobsolete/"; + "optdeblur" , "toolbox/optim/"; + "opteval" , "toolbox/simulink/simulink/private/"; + "optimfcnchk" , "toolbox/shared/optimlib/"; + "optimoptioncheckfield" , "toolbox/shared/optimlib/"; + "optimoptiongetfields" , "toolbox/shared/optimlib/"; + "optimoptions" , "toolbox/shared/optimlib/"; + "optknt" , "toolbox/splines/"; + "optsiminit" , "toolbox/optim/"; + "ord2" , "toolbox/control/control/"; + "ordered_unique_paths" , "toolbox/stateflow/stateflow/private/"; + "ordfilt2" , "toolbox/images/images/"; + "ortc" , "toolbox/robust/"; + "ortr" , "toolbox/robust/"; + "osborne" , "toolbox/robust/"; + "otf2psf" , "toolbox/images/images/"; + "padarray" , "toolbox/images/images/"; + "pade" , "toolbox/control/control/"; + "padess" , "toolbox/simulink/simulink/"; + "padlength" , "toolbox/images/images/private/"; + "pandown" , "toolbox/signal/sptoolgui/private/"; + "panfcn" , "toolbox/signal/sptoolgui/"; + "panner" , "toolbox/signal/sptoolgui/private/"; + "para2fan" , "toolbox/images/images/"; + "parabolic" , "toolbox/pde/"; + "parallel" , "toolbox/control/control/"; + "parallelcoords" , "toolbox/stats/"; + "parameterdlg" , "toolbox/signal/sigtools/"; + "parproc" , "toolbox/ident/idutils/"; + "parseLibCodePaneText" , "toolbox/simulink/simulink/private/"; + "parse_error_msg" , "toolbox/stateflow/stateflow/private/"; + "parse_formatter_strings" , "toolbox/simulink/simcoverage/private/"; + "parse_kernel" , "toolbox/stateflow/stateflow/private/"; + "parse_pv_pairs" , "toolbox/signal/signal/private/"; + "parse_this" , "toolbox/stateflow/stateflow/private/"; + "parseit" , "toolbox/simulink/dee/"; + "parser_unresolved_symbol" , "toolbox/stateflow/stateflow/private/"; + "parzenwin" , "toolbox/signal/signal/"; + "pathdef" , "toolbox/local/"; + "pathdef" , "toolbox/local/template/"; + "pburg" , "toolbox/signal/signal/"; + "pcacov" , "toolbox/stats/"; + "pcares" , "toolbox/stats/"; + "pceye" , "toolbox/optim/"; + "pcgr" , "toolbox/optim/private/"; + "pckkntdm" , "toolbox/splines/"; + "pcov" , "toolbox/signal/signal/"; + "pdeadgsc" , "toolbox/pde/"; + "pdeadworst" , "toolbox/pde/"; + "pdearcl" , "toolbox/pde/"; + "pdeasma" , "toolbox/pde/"; + "pdeasmc" , "toolbox/pde/"; + "pdeasmf" , "toolbox/pde/"; + "pdebasnm" , "toolbox/pde/"; + "pdebddlg" , "toolbox/pde/"; + "pdebddsp" , "toolbox/pde/"; + "pdebound" , "toolbox/pde/"; + "pdebsplit" , "toolbox/pde/"; + "pdecchk" , "toolbox/pde/"; + "pdecgrad" , "toolbox/pde/"; + "pdecirc" , "toolbox/pde/"; + "pdecont" , "toolbox/pde/"; + "pdecrcum" , "toolbox/pde/"; + "pdedemo1" , "toolbox/pde/"; + "pdedemo2" , "toolbox/pde/"; + "pdedemo3" , "toolbox/pde/"; + "pdedemo4" , "toolbox/pde/"; + "pdedemo5" , "toolbox/pde/"; + "pdedemo6" , "toolbox/pde/"; + "pdedemo7" , "toolbox/pde/"; + "pdedemo8" , "toolbox/pde/"; + "pdedemos" , "toolbox/pde/"; + "pdedistr" , "toolbox/pde/"; + "pdedlg" , "toolbox/pde/"; + "pdeeexpd" , "toolbox/pde/"; + "pdeefxpd" , "toolbox/pde/"; + "pdeeig" , "toolbox/pde/"; + "pdeeigx" , "toolbox/pde/"; + "pdeellip" , "toolbox/pde/"; + "pdeent" , "toolbox/pde/"; + "pdeexpd" , "toolbox/pde/"; + "pdeframe" , "toolbox/pde/"; + "pdegeom" , "toolbox/pde/"; + "pdegplot" , "toolbox/pde/"; + "pdegrad" , "toolbox/pde/"; + "pdegrmsc" , "toolbox/pde/"; + "pdehelp" , "toolbox/pde/"; + "pdehloc" , "toolbox/pde/"; + "pdehypdf" , "toolbox/pde/"; + "pdehypf" , "toolbox/pde/"; + "pdehypm" , "toolbox/pde/"; + "pdeicon" , "toolbox/pde/"; + "pdeigeom" , "toolbox/pde/"; + "pdeinfclk" , "toolbox/pde/"; + "pdeinfo" , "toolbox/pde/"; + "pdeinit" , "toolbox/pde/"; + "pdeintrn" , "toolbox/pde/"; + "pdeintrp" , "toolbox/pde/"; + "pdeisfunc" , "toolbox/pde/"; + "pdeisusd" , "toolbox/pde/"; + "pdejmps" , "toolbox/pde/"; + "pdel2fau" , "toolbox/pde/"; + "pdemdlcv" , "toolbox/pde/"; + "pdemesh" , "toolbox/pde/"; + "pdemgeom" , "toolbox/pde/"; + "pdemhdlg" , "toolbox/pde/"; + "pdemtncb" , "toolbox/pde/"; + "pdemvdlg" , "toolbox/pde/"; + "pdenanmn" , "toolbox/pde/"; + "pdenanmx" , "toolbox/pde/"; + "pdenonlin" , "toolbox/pde/"; + "pdenrmfl" , "toolbox/pde/"; + "pdenullorth" , "toolbox/pde/"; + "pdeobdlg" , "toolbox/pde/"; + "pdeonax" , "toolbox/pde/"; + "pdeoutfun" , "toolbox/pde/"; + "pdepatch" , "toolbox/pde/"; + "pdeplot" , "toolbox/pde/"; + "pdepoly" , "toolbox/pde/"; + "pdeprbdf" , "toolbox/pde/"; + "pdeprbf" , "toolbox/pde/"; + "pdeprbm" , "toolbox/pde/"; + "pdeprtni" , "toolbox/pde/"; + "pdepsdlg" , "toolbox/pde/"; + "pdeptdata" , "toolbox/pde/"; + "pdeptdlg" , "toolbox/pde/"; + "pdequote" , "toolbox/pde/"; + "pderect" , "toolbox/pde/"; + "pderel" , "toolbox/pde/"; + "pderesid" , "toolbox/pde/"; + "pderespe" , "toolbox/pde/"; + "pdermpnt" , "toolbox/pde/"; + "pderot3d" , "toolbox/pde/"; + "pdertdlg" , "toolbox/pde/"; + "pdesde" , "toolbox/pde/"; + "pdesdp" , "toolbox/pde/"; + "pdesdt" , "toolbox/pde/"; + "pdeselect" , "toolbox/pde/"; + "pdesetbd" , "toolbox/pde/"; + "pdeseteq" , "toolbox/pde/"; + "pdesetlb" , "toolbox/pde/"; + "pdesldlg" , "toolbox/pde/"; + "pdesmech" , "toolbox/pde/"; + "pdesnap" , "toolbox/pde/"; + "pdespdlg" , "toolbox/pde/"; + "pdesubix" , "toolbox/pde/"; + "pdesurf" , "toolbox/pde/"; + "pdet2str" , "toolbox/pde/"; + "pdetexpd" , "toolbox/pde/"; + "pdetfxpd" , "toolbox/pde/"; + "pdetool" , "toolbox/pde/"; + "pdetrans" , "toolbox/pde/"; + "pdetrdlg" , "toolbox/pde/"; + "pdetrg" , "toolbox/pde/"; + "pdetridi" , "toolbox/pde/"; + "pdetriq" , "toolbox/pde/"; + "pdetxpd" , "toolbox/pde/"; + "pdeuxpd" , "toolbox/pde/"; + "pdevoron" , "toolbox/pde/"; + "pdezoom" , "toolbox/pde/"; + "pdf" , "toolbox/stats/"; + "pdist" , "toolbox/stats/"; + "pe" , "toolbox/ident/ident/"; + "pe_f" , "toolbox/ident/idutils/"; + "pe_fp" , "toolbox/ident/idutils/"; + "pefilt" , "toolbox/ident/idutils/private/"; + "peig" , "toolbox/signal/signal/"; + "pem" , "toolbox/ident/ident/"; + "pemdecod" , "toolbox/ident/idutils/"; + "pemdecod_fp" , "toolbox/ident/idutils/"; + "pendan" , "toolbox/simulink/simdemos/simgeneral/"; + "periodogram" , "toolbox/signal/signal/"; + "perpxy" , "toolbox/control/ctrlobsolete/"; + "perron" , "toolbox/robust/"; + "perturb" , "toolbox/optim/private/"; + "phantom" , "toolbox/images/images/"; + "phase" , "toolbox/ident/idobsolete/"; + "phasedelay" , "toolbox/signal/signal/"; + "phaseticks" , "toolbox/control/ctrlguis/"; + "phasez" , "toolbox/signal/signal/"; + "phone" , "toolbox/signal/sigdemos/"; + "pickfcn" , "toolbox/signal/sptoolgui/private/"; + "pinrect" , "toolbox/signal/sptoolgui/private/"; + "pixval" , "toolbox/images/images/"; + "place" , "toolbox/control/control/"; + "placetitlebar" , "toolbox/stats/private/"; + "plotbode" , "toolbox/control/ctrlobsolete/"; + "plotdatapoints" , "toolbox/optim/"; + "plotnic" , "toolbox/control/ctrlobsolete/"; + "plotnyq" , "toolbox/control/ctrlobsolete/"; + "pltopt" , "toolbox/robust/"; + "pmatchm" , "toolbox/ident/idutils/"; + "pmcov" , "toolbox/signal/signal/"; + "pmem" , "toolbox/signal/signal/"; + "pmtm" , "toolbox/signal/signal/"; + "pmusic" , "toolbox/signal/signal/"; + "pnam2num" , "toolbox/ident/idutils/"; + "pndanim1" , "toolbox/simulink/simdemos/simgeneral/"; + "pndanim2" , "toolbox/simulink/simdemos/simgeneral/"; + "pndanim3" , "toolbox/simulink/simdemos/simgeneral/"; + "pnmatch" , "toolbox/ident/idutils/"; + "pnmatch" , "toolbox/control/ctrlutil/"; + "pnmatchd" , "toolbox/ident/idutils/"; + "pnsortd" , "toolbox/ident/idutils/"; + "poiasma" , "toolbox/pde/"; + "poicalc" , "toolbox/pde/"; + "poiindex" , "toolbox/pde/"; + "poimesh" , "toolbox/pde/"; + "pointtip" , "toolbox/shared/controllib/"; + "poisolv" , "toolbox/pde/"; + "poisscdf" , "toolbox/stats/"; + "poissfit" , "toolbox/stats/"; + "poissinv" , "toolbox/stats/"; + "poisspdf" , "toolbox/stats/"; + "poissrnd" , "toolbox/stats/"; + "poisstat" , "toolbox/stats/"; + "poly2ac" , "toolbox/signal/signal/"; + "poly2edgelist" , "toolbox/images/images/private/"; + "poly2lsf" , "toolbox/signal/signal/"; + "poly2mask" , "toolbox/images/images/"; + "poly2rc" , "toolbox/signal/signal/"; + "poly2str" , "toolbox/control/ctrlobsolete/"; + "poly2sym" , "toolbox/symbolic/"; + "poly2th" , "toolbox/ident/idobsolete/"; + "polyconf" , "toolbox/stats/"; + "polyform" , "toolbox/ident/idobsolete/"; + "polyscale" , "toolbox/signal/signal/"; + "polystab" , "toolbox/signal/signal/"; + "polytool" , "toolbox/stats/"; + "popdemo" , "toolbox/simulink/simdemos/"; + "port" , "toolbox/control/ctrldemos/private/"; + "powerwindow02script" , "toolbox/simulink/simdemos/automotive/"; + "powerwindow03script" , "toolbox/simulink/simdemos/automotive/"; + "powerwindow04script" , "toolbox/simulink/simdemos/automotive/"; + "powerwindow05script" , "toolbox/simulink/simdemos/automotive/"; + "powerwindowscript" , "toolbox/simulink/simdemos/automotive/"; + "pp2sp" , "toolbox/splines/"; + "ppalldem" , "toolbox/splines/"; + "ppbrk" , "toolbox/splines/"; + "ppcgr" , "toolbox/optim/private/"; + "ppmak" , "toolbox/splines/"; + "pprfn" , "toolbox/splines/"; + "ppual" , "toolbox/splines/"; + "prctile" , "toolbox/stats/"; + "preaug" , "toolbox/optim/private/"; + "predict" , "toolbox/ident/ident/"; + "prefcnchk" , "toolbox/simulink/simulink/private/"; + "prefspanel" , "toolbox/signal/signal/"; + "preload_diff" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "preload_feedback" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "preload_integrate" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "preload_lead_lag" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "preload_state_space" , "toolbox/simulink/fixedandfloat/fxpdemos/"; + "preprocess_truth_table" , "toolbox/stateflow/stateflow/private/"; + "present" , "toolbox/ident/idobsolete/"; + "princomp" , "toolbox/stats/"; + "print_html_str" , "toolbox/stateflow/stateflow/private/"; + "printcomp" , "toolbox/signal/sptoolgui/"; + "printdamp" , "toolbox/control/ctrlutil/"; + "printframe" , "toolbox/simulink/simulink/"; + "printmat" , "toolbox/control/ctrlobsolete/"; + "printofficeassign" , "toolbox/optim/"; + "printopt" , "toolbox/local/"; + "printsys" , "toolbox/control/ctrlobsolete/"; + "printtext" , "toolbox/simulink/simulink/private/"; + "private_sl_decpath" , "toolbox/simulink/simulink/"; + "private_sl_enc2normalpath" , "toolbox/simulink/simulink/"; + "private_sl_encpath" , "toolbox/simulink/simulink/"; + "prm_disp_cntrl" , "toolbox/rtw/rtw/"; + "probplot" , "toolbox/stats/"; + "procmod" , "toolbox/ident/idutils/"; + "procrustes" , "toolbox/stats/"; + "project" , "toolbox/optim/private/"; + "prony" , "toolbox/signal/signal/"; + "psd" , "toolbox/signal/signal/"; + "psdchk" , "toolbox/signal/signal/private/"; + "psddemo" , "toolbox/signal/sigdemos/"; + "psdfreqvec" , "toolbox/signal/signal/"; + "psdoptions" , "toolbox/signal/signal/"; + "psdplot" , "toolbox/signal/signal/"; + "psf2otf" , "toolbox/images/images/"; + "psv" , "toolbox/robust/"; + "pulstran" , "toolbox/signal/signal/"; + "pvformat" , "toolbox/control/ctrlutil/"; + "pwelch" , "toolbox/signal/signal/"; + "pyulear" , "toolbox/signal/signal/"; + "pzmap" , "toolbox/control/control/"; + "qfilt2dfilt" , "toolbox/signal/sigtools/"; + "qfiltexists" , "toolbox/signal/sigtools/"; + "qpsub" , "toolbox/optim/private/"; + "qpsub" , "toolbox/simulink/simulink/private/"; + "qqplot" , "toolbox/stats/"; + "qtdecomp" , "toolbox/images/images/"; + "qtdemo" , "toolbox/images/imdemos/"; + "qtgetblk" , "toolbox/images/images/"; + "qtsetblk" , "toolbox/images/images/"; + "quad2" , "toolbox/optim/"; + "quadi" , "toolbox/optim/"; + "quadprog" , "toolbox/optim/"; + "quantile" , "toolbox/stats/"; + "quantize" , "toolbox/simulink/blocks/"; + "quine_mcclusky" , "toolbox/stateflow/stateflow/private/"; + "radon" , "toolbox/images/images/"; + "radonc" , "toolbox/images/images/private/"; + "randg" , "toolbox/stats/"; + "random" , "toolbox/stats/"; + "randsample" , "toolbox/stats/"; + "randtool" , "toolbox/stats/"; + "randunc" , "toolbox/sloptim/sloptim/"; + "range" , "toolbox/stats/"; + "ranksum" , "toolbox/stats/"; + "rarmax" , "toolbox/ident/ident/"; + "rarx" , "toolbox/ident/ident/"; + "raylcdf" , "toolbox/stats/"; + "raylfit" , "toolbox/stats/"; + "raylinv" , "toolbox/stats/"; + "raylpdf" , "toolbox/stats/"; + "raylrnd" , "toolbox/stats/"; + "raylstat" , "toolbox/stats/"; + "rbj" , "toolbox/ident/ident/"; + "rc2ac" , "toolbox/signal/signal/"; + "rc2is" , "toolbox/signal/signal/"; + "rc2lar" , "toolbox/signal/signal/"; + "rc2poly" , "toolbox/signal/signal/"; + "rceps" , "toolbox/signal/signal/"; + "rcoplot" , "toolbox/stats/"; + "rct2lti" , "toolbox/robust/"; + "rctdemo" , "toolbox/robust/"; + "rctdemo1" , "toolbox/robust/"; + "rdsigma" , "toolbox/robust/"; + "readstdtcdata" , "toolbox/simulink/simdemos/simfeatures/"; + "reconcile_function_io" , "toolbox/stateflow/stateflow/private/"; + "rectconv" , "toolbox/simulink/simulink/private/"; + "rectpuls" , "toolbox/signal/signal/"; + "rectwin" , "toolbox/signal/signal/"; + "refcurve" , "toolbox/stats/"; + "refinemesh" , "toolbox/pde/"; + "reflect" , "toolbox/optim/private/"; + "refline" , "toolbox/stats/"; + "reg" , "toolbox/control/control/"; + "regionprops" , "toolbox/images/images/"; + "regress" , "toolbox/stats/"; + "regstats" , "toolbox/stats/"; + "reig" , "toolbox/robust/"; + "rel_path" , "toolbox/stateflow/stateflow/private/"; + "release_version" , "toolbox/rtw/rtw/"; + "remdemo" , "toolbox/robust/"; + "remez" , "toolbox/signal/signal/"; + "remezord" , "toolbox/signal/signal/"; + "removeampersands" , "toolbox/signal/sigtools/private/"; + "removetrailzeros" , "toolbox/signal/sigtools/"; + "remstr" , "toolbox/signal/sptoolgui/private/"; + "render_cshelpbtn" , "toolbox/signal/sigtools/"; + "render_gridonoffbtn" , "toolbox/signal/sigtools/"; + "render_hiddenzoombtns" , "toolbox/signal/sigtools/private/"; + "render_legendonoffbtn" , "toolbox/signal/sigtools/"; + "render_spteditmenu" , "toolbox/signal/sigtools/"; + "render_sptfilemenu" , "toolbox/signal/sigtools/"; + "render_spthelpmenu" , "toolbox/signal/sigtools/"; + "render_sptinsertmenu" , "toolbox/signal/sigtools/"; + "render_sptprintbtns" , "toolbox/signal/sigtools/"; + "render_sptscribebtns" , "toolbox/signal/sigtools/"; + "render_spttoolsmenu" , "toolbox/signal/sigtools/"; + "render_sptwindowmenu" , "toolbox/signal/sigtools/"; + "render_statusbar" , "toolbox/signal/sigtools/"; + "render_zoombtns" , "toolbox/signal/sigtools/"; + "render_zoommenus" , "toolbox/signal/sigtools/"; + "reorderstructure" , "toolbox/signal/sigtools/"; + "replace_block" , "toolbox/simulink/simulink/"; + "resample" , "toolbox/signal/signal/"; + "resetPropertyFactoryValue" , "toolbox/shared/dastudio/"; + "reset_target_code_flags" , "toolbox/stateflow/stateflow/private/"; + "resetaxes" , "toolbox/signal/sigtools/private/"; + "reshapemask" , "toolbox/simulink/blocks/"; + "resid" , "toolbox/ident/idobsolete/"; + "residuez" , "toolbox/signal/signal/"; + "resistor" , "toolbox/control/ctrldemos/private/"; + "resizedispatch" , "toolbox/signal/sptoolgui/private/"; + "respdemo" , "toolbox/control/ctrldemos/"; + "restorePrm" , "toolbox/simulink/simulink/private/"; + "restoredefaultpath" , "toolbox/local/"; + "revertit" , "toolbox/simulink/dee/"; + "rfinputs" , "toolbox/control/ctrlguis/"; + "rg" , "toolbox/stateflow/stateflow/private/"; + "rg_dialog" , "toolbox/stateflow/stateflow/private/"; + "rg_nice_shot" , "toolbox/stateflow/stateflow/private/"; + "rg_printbook_cant_handle_chart" , "toolbox/stateflow/stateflow/private/"; + "rgb2gray" , "toolbox/images/images/"; + "rgb2ind" , "toolbox/images/images/"; + "rgb2ntsc" , "toolbox/images/images/"; + "rgb2ycbcr" , "toolbox/images/images/"; + "rguipopts" , "toolbox/control/ctrlguis/"; + "ric" , "toolbox/control/ctrlobsolete/"; + "riccond" , "toolbox/robust/"; + "ridge" , "toolbox/stats/"; + "rk23" , "toolbox/simulink/simulink/"; + "rk45" , "toolbox/simulink/simulink/"; + "rlcdemo" , "toolbox/control/ctrldemos/"; + "rlevinson" , "toolbox/signal/signal/"; + "rlocfind" , "toolbox/control/control/"; + "rloclims" , "toolbox/control/ctrlguis/"; + "rlocmult" , "toolbox/control/ctrlutil/"; + "rlocus" , "toolbox/control/control/"; + "rlsests" , "toolbox/simulink/simdemos/"; + "rlspps" , "toolbox/simulink/simdemos/"; + "rltool" , "toolbox/control/control/"; + "rmdynprop" , "toolbox/signal/sigtools/"; + "rmnk" , "toolbox/ident/idutils/"; + "rmodel" , "toolbox/robust/"; + "rmodel" , "toolbox/control/control/"; + "rmprops" , "toolbox/signal/sigtools/"; + "robustdemo" , "toolbox/stats/"; + "robustfit" , "toolbox/stats/"; + "roe" , "toolbox/ident/ident/"; + "roicolor" , "toolbox/images/images/"; + "roidemo" , "toolbox/images/imdemos/"; + "roifill" , "toolbox/images/images/"; + "roifilt2" , "toolbox/images/images/"; + "roipoly" , "toolbox/images/images/"; + "roipolyold" , "toolbox/images/images/"; + "rootddg" , "toolbox/simulink/simulink/"; + "rooteig" , "toolbox/signal/signal/"; + "rootmusic" , "toolbox/signal/signal/"; + "rootobjectenum" , "toolbox/simulink/simulink/"; + "rotatefactors" , "toolbox/stats/"; + "roundfocus" , "toolbox/ident/idutils/private/"; + "rowexch" , "toolbox/stats/"; + "rpbrk" , "toolbox/splines/"; + "rpem" , "toolbox/ident/ident/"; + "rplr" , "toolbox/ident/ident/"; + "rpmak" , "toolbox/splines/"; + "rsbrk" , "toolbox/splines/"; + "rschur" , "toolbox/robust/"; + "rsigma" , "toolbox/robust/"; + "rsmak" , "toolbox/splines/"; + "rsmdemo" , "toolbox/stats/"; + "rss" , "toolbox/control/control/"; + "rstool" , "toolbox/stats/"; + "rsums" , "toolbox/symbolic/"; + "rsval" , "toolbox/splines/"; + "rtmdlsortflds" , "toolbox/rtw/rtw/"; + "rtslider" , "toolbox/control/ctrldemos/private/"; + "rtw_c" , "toolbox/rtw/rtw/"; + "rtw_cgt_name_conv" , "toolbox/rtw/rtw/"; + "rtw_checkdir" , "toolbox/rtw/rtw/"; + "rtw_copy_file" , "toolbox/rtw/rtw/"; + "rtw_delete_file" , "toolbox/rtw/rtw/"; + "rtw_expand_template" , "toolbox/rtw/rtw/"; + "rtw_expand_template_from_tlc" , "toolbox/rtw/rtw/"; + "rtw_fileparts" , "toolbox/rtw/rtw/"; + "rtw_gen_shared_utils" , "toolbox/rtw/rtw/"; + "rtw_host_implementation_props" , "toolbox/rtw/rtw/"; + "rtw_implementation_props" , "toolbox/rtw/rtw/"; + "rtw_is_hardware_state_unknown" , "toolbox/rtw/rtw/"; + "rtw_mlscript_tlcgen" , "toolbox/rtw/rtw/"; + "rtw_optimization_info" , "toolbox/stateflow/stateflow/private/"; + "rtw_prodhw_get" , "toolbox/rtw/rtw/"; + "rtw_prodhw_sizes" , "toolbox/rtw/rtw/"; + "rtw_rsim_mdlref_compatibility" , "toolbox/rtw/rtw/"; + "rtw_shared_utils_enabled" , "toolbox/stateflow/stateflow/private/"; + "rtw_target_fcn_lib_mgr" , "toolbox/simulink/simulink/"; + "rtw_target_methods" , "toolbox/stateflow/stateflow/private/"; + "rtw_target_props" , "toolbox/stateflow/coder/private/"; + "rtwbuild" , "toolbox/rtw/rtw/"; + "rtwconfiguremodel" , "toolbox/rtw/rtw/"; + "rtwdwork_inspect" , "toolbox/simulink/simdemos/"; + "rtwenvironmentmode" , "toolbox/simulink/simulink/"; + "rtwgen" , "toolbox/rtw/rtw/"; + "rtwgettargetfcnlib" , "toolbox/simulink/simulink/"; + "rtwhostwordlengths" , "toolbox/rtw/rtw/"; + "rtwmaputil" , "toolbox/rtw/rtw/"; + "rtwmath_base_fcn_name_list" , "toolbox/simulink/simulink/"; + "rtwmath_data_type_prop_list" , "toolbox/simulink/simulink/"; + "rtwprivate" , "toolbox/rtw/rtw/"; + "rtwrebuild" , "toolbox/rtw/rtw/"; + "rtwsampleconfig" , "toolbox/rtw/rtw/"; + "rtwwordlengths" , "toolbox/rtw/rtw/"; + "ruldown" , "toolbox/signal/sptoolgui/private/"; + "ruler" , "toolbox/signal/sptoolgui/private/"; + "rulermo" , "toolbox/signal/sptoolgui/private/"; + "rules" , "toolbox/simulink/components/private/"; + "runabs" , "toolbox/simulink/simdemos/automotive/"; + "runfleq1" , "toolbox/optim/"; + "runnls3" , "toolbox/optim/"; + "runqpbox4" , "toolbox/optim/"; + "runqpbox4prec" , "toolbox/optim/"; + "runqpeq5" , "toolbox/optim/"; + "runtracklsq" , "toolbox/optim/"; + "runtrackmm" , "toolbox/optim/"; + "safely_execute_dos_command" , "toolbox/stateflow/stateflow/private/"; + "same" , "toolbox/robust/"; + "sample" , "toolbox/ident/idobsolete/"; + "sample" , "toolbox/ident/idutils/"; + "samplesizedemo" , "toolbox/stats/"; + "sanim" , "toolbox/simulink/simdemos/aerospace/"; + "sanim3dof" , "toolbox/simulink/simdemos/aerospace/"; + "sanity_check_chart_simulink_block" , "toolbox/stateflow/stateflow/private/"; + "saveAndSetPrm" , "toolbox/simulink/simulink/private/"; + "save_system" , "toolbox/simulink/simulink/"; + "sawtooth" , "toolbox/signal/signal/"; + "sbarray" , "toolbox/signal/sptoolgui/private/"; + "sbclose" , "toolbox/signal/sptoolgui/private/"; + "sbcmplx" , "toolbox/signal/sptoolgui/private/"; + "sbhelpstr" , "toolbox/signal/sptoolgui/private/"; + "sbinit" , "toolbox/signal/sptoolgui/private/"; + "sbmotion" , "toolbox/signal/sptoolgui/private/"; + "sbresize" , "toolbox/signal/sptoolgui/private/"; + "sbswitch" , "toolbox/signal/sptoolgui/"; + "sbtitle" , "toolbox/signal/sptoolgui/private/"; + "sbzoom" , "toolbox/signal/sptoolgui/private/"; + "scalevaluefixup" , "toolbox/signal/sigtools/"; + "scalewinfo" , "toolbox/signal/sigdemos/private/"; + "scalewinzo" , "toolbox/signal/sigdemos/private/"; + "scalingfactor" , "toolbox/signal/sigdemos/private/"; + "scatterb" , "toolbox/pde/"; + "scatterg" , "toolbox/pde/"; + "scdtmpini" , "toolbox/slcontrol/slctrldemos/"; + "scdtmpinit" , "toolbox/slcontrol/slctrldemos/"; + "schart" , "toolbox/stats/"; + "schbal" , "toolbox/robust/"; + "schmr" , "toolbox/robust/"; + "schord" , "toolbox/control/ctrlobsolete/"; + "schurrc" , "toolbox/signal/signal/"; + "scopebar" , "toolbox/simulink/simulink/"; + "scopebarsv" , "toolbox/simulink/simulink/"; + "scopezoom" , "toolbox/simulink/simulink/"; + "scpprop" , "toolbox/simulink/simulink/"; + "scppropsv" , "toolbox/simulink/simulink/"; + "searchq" , "toolbox/optim/"; + "sec2tss" , "toolbox/robust/"; + "sectf" , "toolbox/robust/"; + "sectf88" , "toolbox/robust/"; + "segment" , "toolbox/ident/ident/"; + "selstruc" , "toolbox/ident/ident/"; + "semicon" , "toolbox/optim/"; + "seqperiod" , "toolbox/signal/signal/"; + "series" , "toolbox/control/control/"; + "sershbl" , "toolbox/robust/"; + "setActiveConfigSet" , "toolbox/simulink/simulink/"; + "setHardwareDevice" , "toolbox/simulink/simulink/private/"; + "set_eml_script" , "toolbox/simulink/simulink/"; + "set_mask_display" , "toolbox/stateflow/stateflow/private/"; + "set_param" , "toolbox/simulink/simulink/"; + "set_signal_name_for_out_port" , "toolbox/stateflow/stateflow/private/"; + "set_target_code_flags" , "toolbox/stateflow/stateflow/private/"; + "setcoincidentgrid" , "toolbox/signal/sigtools/"; + "setdatamarkers" , "toolbox/signal/sigtools/"; + "setenableprop" , "toolbox/signal/sigtools/"; + "setjavaxtreenode" , "toolbox/simulink/blocks/private/"; + "setjavaxtreenode" , "toolbox/simulink/simulink/private/"; + "setlinio" , "toolbox/slcontrol/slcontrol/"; + "setpname" , "toolbox/ident/idutils/"; + "setrul" , "toolbox/signal/sptoolgui/private/"; + "setrulxdata" , "toolbox/signal/sptoolgui/private/"; + "setsigpref" , "toolbox/signal/sptoolgui/"; + "setslopeline" , "toolbox/signal/sptoolgui/private/"; + "setstructfields" , "toolbox/signal/sigtools/"; + "setsysloc" , "toolbox/simulink/simulink/"; + "sett" , "toolbox/ident/idobsolete/"; + "setup_for_borland" , "toolbox/rtw/rtw/"; + "setup_for_intel" , "toolbox/rtw/rtw/"; + "setup_for_lcc" , "toolbox/rtw/rtw/"; + "setup_for_visual" , "toolbox/rtw/rtw/"; + "setup_for_watcom" , "toolbox/rtw/rtw/"; + "setxu" , "toolbox/slcontrol/slcontrol/"; + "setzoomstate" , "toolbox/signal/sigtools/"; + "sf_add_custom_menu" , "toolbox/stateflow/stateflow/private/"; + "sf_aerodyn" , "toolbox/control/ctrldemos/"; + "sf_bridge_state" , "toolbox/stateflow/sfdemos/"; + "sf_comment" , "toolbox/stateflow/coder/private/"; + "sf_copyobj" , "toolbox/stateflow/stateflow/private/"; + "sf_cruise_button_mgr" , "toolbox/stateflow/sfdemos/"; + "sf_cruise_control_ui" , "toolbox/stateflow/sfdemos/"; + "sf_date_num" , "toolbox/stateflow/stateflow/private/"; + "sf_date_str" , "toolbox/stateflow/stateflow/private/"; + "sf_deal_cards" , "toolbox/stateflow/sfdemos/"; + "sf_debug_exec" , "toolbox/stateflow/stateflow/private/"; + "sf_debug_exit_trap" , "toolbox/stateflow/stateflow/private/"; + "sf_debugger_trap" , "toolbox/stateflow/stateflow/private/"; + "sf_delete_file" , "toolbox/stateflow/stateflow/private/"; + "sf_demo_disclaimer" , "toolbox/stateflow/stateflow/private/"; + "sf_display" , "toolbox/stateflow/stateflow/private/"; + "sf_dos" , "toolbox/stateflow/stateflow/private/"; + "sf_echo_generating" , "toolbox/stateflow/coder/private/"; + "sf_edit_icon" , "toolbox/stateflow/sfdemos/"; + "sf_elevator_gui" , "toolbox/stateflow/sfdemos/"; + "sf_evalin_base" , "toolbox/stateflow/coder/private/"; + "sf_figure" , "toolbox/stateflow/stateflow/private/"; + "sf_force_open_machine" , "toolbox/stateflow/stateflow/private/"; + "sf_get_component_root" , "toolbox/stateflow/stateflow/private/"; + "sf_get_icon_data" , "toolbox/stateflow/stateflow/private/"; + "sf_get_reference_block_name" , "toolbox/stateflow/stateflow/private/"; + "sf_get_schema" , "toolbox/stateflow/stateflow/private/"; + "sf_hg_get" , "toolbox/stateflow/stateflow/private/"; + "sf_hg_set" , "toolbox/stateflow/stateflow/private/"; + "sf_hier_print" , "toolbox/stateflow/stateflow/private/"; + "sf_inhibit_code" , "toolbox/stateflow/sfdemos/"; + "sf_inject_event" , "toolbox/stateflow/sfdemos/"; + "sf_keyboard" , "toolbox/stateflow/stateflow/private/"; + "sf_load_model" , "toolbox/stateflow/stateflow/private/"; + "sf_mandel_gui" , "toolbox/stateflow/sfdemos/"; + "sf_mark_block_as_tainted" , "toolbox/stateflow/stateflow/private/"; + "sf_menu_mode" , "toolbox/stateflow/stateflow/private/"; + "sf_mk_dir" , "toolbox/stateflow/stateflow/private/"; + "sf_profile" , "toolbox/stateflow/stateflow/private/"; + "sf_root" , "toolbox/stateflow/stateflow/private/"; + "sf_rtw" , "toolbox/stateflow/stateflow/private/"; + "sf_rtw" , "toolbox/rtw/rtw/"; + "sf_scalar2str" , "toolbox/stateflow/stateflow/private/"; + "sf_simtime_throttle" , "toolbox/stateflow/sfdemos/"; + "sf_snr_inject_event" , "toolbox/stateflow/stateflow/private/"; + "sf_srch" , "toolbox/stateflow/stateflow/private/"; + "sf_stickslipedit" , "toolbox/stateflow/sfdemos/"; + "sf_tetris_gui" , "toolbox/stateflow/sfdemos/"; + "sf_tictacflow_mex" , "toolbox/stateflow/sfdemos/"; + "sf_tictacflow_simgui" , "toolbox/stateflow/sfdemos/"; + "sf_tictacflowgui" , "toolbox/stateflow/sfdemos/"; + "sf_tmp_undo_marker" , "toolbox/stateflow/stateflow/private/"; + "sf_type_enum_from_name" , "toolbox/stateflow/coder/private/"; + "sf_uicontextmenu" , "toolbox/stateflow/stateflow/private/"; + "sf_uicontrol" , "toolbox/stateflow/stateflow/private/"; + "sf_use_silent_build" , "toolbox/stateflow/stateflow/private/"; + "sfabout" , "toolbox/stateflow/stateflow/private/"; + "sfbcheckports" , "toolbox/simulink/simulink/private/"; + "sfbcheckstates" , "toolbox/simulink/simulink/private/"; + "sfbdroot" , "toolbox/stateflow/stateflow/private/"; + "sfblk" , "toolbox/stateflow/stateflow/private/"; + "sfbuilder_mexbuild" , "toolbox/simulink/simulink/private/"; + "sfc" , "toolbox/stateflow/coder/"; + "sfcall" , "toolbox/stateflow/stateflow/private/"; + "sfclipboard" , "toolbox/stateflow/stateflow/"; + "sfclose" , "toolbox/stateflow/stateflow/"; + "sfcndemo_hg_gui_m" , "toolbox/simulink/simdemos/"; + "sfcndemo_rtwcmd" , "toolbox/simulink/simdemos/"; + "sfcustom" , "toolbox/stateflow/stateflow/private/"; + "sfd" , "toolbox/optim/"; + "sfdbfig" , "toolbox/stateflow/stateflow/private/"; + "sfdebug" , "toolbox/stateflow/stateflow/private/"; + "sfdebug_get_linenum" , "toolbox/stateflow/stateflow/private/"; + "sfdebug_paused" , "toolbox/stateflow/stateflow/private/"; + "sfdebug_using_java" , "toolbox/stateflow/stateflow/private/"; + "sfdebugger" , "toolbox/stateflow/stateflow/"; + "sfdlg" , "toolbox/stateflow/stateflow/private/"; + "sfdnls" , "toolbox/optim/"; + "sfexit" , "toolbox/stateflow/stateflow/"; + "sfexplr" , "toolbox/stateflow/stateflow/"; + "sffind" , "toolbox/stateflow/stateflow/"; + "sfhelp" , "toolbox/stateflow/stateflow/"; + "sfinit" , "toolbox/stateflow/stateflow/private/"; + "sfix" , "toolbox/simulink/fixedandfloat/"; + "sfl" , "toolbox/robust/"; + "sflibrary" , "toolbox/stateflow/stateflow/private/"; + "sfminbx" , "toolbox/optim/"; + "sfminle" , "toolbox/optim/"; + "sfnew" , "toolbox/stateflow/stateflow/"; + "sfopen" , "toolbox/stateflow/stateflow/"; + "sfpcode" , "toolbox/stateflow/stateflow/private/"; + "sfpref" , "toolbox/stateflow/stateflow/"; + "sfprint" , "toolbox/stateflow/stateflow/"; + "sfprivate" , "toolbox/stateflow/stateflow/"; + "sfr" , "toolbox/robust/"; + "sfrac" , "toolbox/simulink/fixedandfloat/"; + "sfreplace" , "toolbox/stateflow/stateflow/"; + "sfroot" , "toolbox/stateflow/stateflow/"; + "sfrtw_compliant" , "toolbox/rtw/rtw/"; + "sfsave" , "toolbox/stateflow/stateflow/"; + "sfsim" , "toolbox/stateflow/stateflow/private/"; + "sfslbridge" , "toolbox/stateflow/stateflow/"; + "sfslfind" , "toolbox/stateflow/stateflow/private/"; + "sfsnr" , "toolbox/stateflow/stateflow/private/"; + "sfsrch" , "toolbox/stateflow/stateflow/private/"; + "sfstyler" , "toolbox/stateflow/stateflow/private/"; + "sftab2chk" , "toolbox/simulink/blocks/"; + "sftiffprintall" , "toolbox/stateflow/stateflow/private/"; + "sfun_bitopcbk" , "toolbox/simulink/blocks/"; + "sfun_target_methods" , "toolbox/stateflow/stateflow/private/"; + "sfun_varargm" , "toolbox/simulink/blocks/"; + "sfunbuilderports" , "toolbox/simulink/simulink/private/"; + "sfuncont" , "toolbox/simulink/blocks/"; + "sfuncorr" , "toolbox/simulink/blocks/"; + "sfunctionwizard" , "toolbox/simulink/simulink/"; + "sfunddg" , "toolbox/simulink/blocks/"; + "sfunddg_cb" , "toolbox/simulink/blocks/"; + "sfunddg_fs" , "toolbox/simulink/blocks/private/"; + "sfundemo_helper" , "toolbox/simulink/simdemos/"; + "sfundemo_maskdisp" , "toolbox/simulink/simdemos/"; + "sfundemo_open" , "toolbox/simulink/simdemos/"; + "sfundemo_openfcn" , "toolbox/simulink/simdemos/"; + "sfundsc1" , "toolbox/simulink/blocks/"; + "sfundsc2" , "toolbox/simulink/blocks/"; + "sfunid" , "toolbox/ident/iddemos/"; + "sfunlin" , "toolbox/simulink/blocks/"; + "sfunmem" , "toolbox/simulink/blocks/"; + "sfunpsd" , "toolbox/simulink/blocks/"; + "sfuntf" , "toolbox/simulink/blocks/"; + "sfuntmpl" , "toolbox/simulink/blocks/"; + "sfunxy" , "toolbox/simulink/blocks/"; + "sfunxys" , "toolbox/simulink/blocks/"; + "sfuny" , "toolbox/simulink/blocks/"; + "sfunyst" , "toolbox/simulink/blocks/"; + "sfversion" , "toolbox/stateflow/stateflow/"; + "sgolay" , "toolbox/signal/signal/"; + "sgolaydemo" , "toolbox/signal/sigdemos/"; + "sgolayfilt" , "toolbox/signal/signal/"; + "sgrid" , "toolbox/control/control/"; + "shiftdata" , "toolbox/signal/signal/"; + "shiftsc" , "toolbox/optim/private/"; + "showblockdatatypetable" , "toolbox/simulink/simdemos/"; + "showrootcs" , "toolbox/simulink/simulink/"; + "shuffle" , "toolbox/stateflow/stateflow/private/"; + "sido2n" , "toolbox/ident/idguis/"; + "sigSpecDataTypeParamCallBackFcn" , "toolbox/simulink/blocks/"; + "sigandscopemgr" , "toolbox/simulink/simulink/"; + "sigbrowse" , "toolbox/signal/sptoolgui/"; + "sigbuilder" , "toolbox/simulink/simulink/"; + "sigbuilder_beveled_frame" , "toolbox/simulink/simulink/private/"; + "sigbuilder_block" , "toolbox/simulink/simulink/"; + "sigbuilder_makemenu" , "toolbox/simulink/simulink/private/"; + "sigbuilder_modal_edit_dialog" , "toolbox/simulink/simulink/private/"; + "sigbuilder_tabselector" , "toolbox/simulink/simulink/"; + "sigcombobox" , "toolbox/signal/sigtools/"; + "sigdemo1" , "toolbox/signal/sigdemos/"; + "sigdemo2" , "toolbox/signal/sigdemos/"; + "siggetappdata" , "toolbox/signal/sigtools/"; + "sigisappdata" , "toolbox/signal/sigtools/"; + "siglogdialog" , "toolbox/simulink/simulink/"; + "sigma" , "toolbox/control/control/"; + "sigmpoles" , "toolbox/signal/sigtools/"; + "signalbuilder" , "toolbox/simulink/simulink/"; + "signalpolyutils" , "toolbox/signal/signal/"; + "signalselector" , "toolbox/simulink/simulink/"; + "signrank" , "toolbox/stats/"; + "signtest" , "toolbox/stats/"; + "sigprivate" , "toolbox/signal/signal/"; + "sigpropddg" , "toolbox/simulink/simulink/"; + "sigrmappdata" , "toolbox/signal/sigtools/"; + "sigsetappdata" , "toolbox/signal/sigtools/"; + "sigspecmask" , "toolbox/simulink/blocks/"; + "silhouette" , "toolbox/stats/"; + "sim" , "toolbox/simulink/simulink/"; + "sim_open_sys" , "toolbox/stateflow/stateflow/private/"; + "simbrowse" , "toolbox/simulink/simulink/"; + "simcad" , "toolbox/simulink/simdemos/"; + "simclock" , "toolbox/simulink/simulink/"; + "simcnstr" , "toolbox/simulink/simulink/"; + "simcontdesigner" , "toolbox/slcontrol/slctrlguis/"; + "simget" , "toolbox/simulink/simulink/"; + "simintro" , "toolbox/simulink/simdemos/"; + "simlp" , "toolbox/simulink/simulink/"; + "simmenu" , "toolbox/simulink/simulink/private/"; + "simom" , "toolbox/simulink/blocks/"; + "simom2" , "toolbox/simulink/blocks/"; + "simplex" , "toolbox/optim/private/"; + "simplexphaseone" , "toolbox/optim/private/"; + "simplexphasetwo" , "toolbox/optim/private/"; + "simplexpiecewise" , "toolbox/optim/private/"; + "simplexpostsolve" , "toolbox/optim/private/"; + "simplexpresolve" , "toolbox/optim/private/"; + "simplot" , "toolbox/simulink/simulink/"; + "simprintdlg" , "toolbox/simulink/simulink/"; + "simprintlog" , "toolbox/simulink/simulink/"; + "simprm" , "toolbox/simulink/simulink/"; + "simprmDlgCloseCallback" , "toolbox/simulink/simulink/private/"; + "simprmfield2prmmap" , "toolbox/simulink/simulink/"; + "simprmtagmap" , "toolbox/simulink/simulink/"; + "simscope" , "toolbox/simulink/simulink/"; + "simscopesv" , "toolbox/simulink/simulink/"; + "simset" , "toolbox/simulink/simulink/"; + "simsizes" , "toolbox/simulink/simulink/"; + "simulink" , "toolbox/simulink/blocks/"; + "simulinkrc" , "toolbox/local/"; + "simver" , "toolbox/simulink/simulink/"; + "sinc" , "toolbox/signal/signal/"; + "sinint" , "toolbox/symbolic/"; + "sint" , "toolbox/simulink/fixedandfloat/"; + "sisotool" , "toolbox/control/control/"; + "sizedat" , "toolbox/ident/idutils/"; + "skewness" , "toolbox/stats/"; + "skipdata" , "toolbox/robust/"; + "sl" , "toolbox/simulink/simulink/"; + "slCfgPrmDlg" , "toolbox/simulink/simulink/"; + "slCharacterEncoding" , "toolbox/simulink/simulink/"; + "slDDGUtil" , "toolbox/simulink/simulink/"; + "slDialogUtil" , "toolbox/simulink/simulink/"; + "slResolve" , "toolbox/simulink/simulink/"; + "sl_convert_to_model_reference" , "toolbox/simulink/simulink/"; + "sl_disp_info" , "toolbox/simulink/simulink/private/"; + "sl_file_is_newer" , "toolbox/simulink/simulink/private/"; + "sl_get_dialog_schema" , "toolbox/simulink/simulink/"; + "sl_get_file_date" , "toolbox/simulink/simulink/private/"; + "sl_open" , "toolbox/stateflow/stateflow/private/"; + "sl_snr_inject_event" , "toolbox/shared/dastudio/"; + "sl_type_enum_from_name" , "toolbox/stateflow/coder/private/"; + "sl_unified_lookup2d_dialog" , "toolbox/simulink/blocks/"; + "slblkpropdlg" , "toolbox/simulink/simulink/"; + "slblks" , "toolbox/simulink/blocks/"; + "slblocks" , "toolbox/slcontrol/slctrlutil/"; + "slblocks" , "toolbox/control/control/"; + "slblocks" , "toolbox/rtw/rtw/"; + "slblocks" , "toolbox/sloptim/sloptim/"; + "slblocks" , "toolbox/stateflow/stateflow/"; + "slblocks" , "toolbox/ident/ident/"; + "slblocks" , "toolbox/simulink/blocks/"; + "slbuild" , "toolbox/simulink/simulink/"; + "slchangelog" , "toolbox/simulink/simulink/"; + "slcheckprelookups" , "toolbox/simulink/simdemos/simfeatures/"; + "slcm" , "toolbox/simulink/simulink/"; + "slctrlexplorer" , "toolbox/shared/slcontrollib/"; + "sldatastoredlg" , "toolbox/simulink/blocks/"; + "sldebug" , "toolbox/simulink/simulink/"; + "sldebugui" , "toolbox/simulink/simulink/"; + "sldemo_bpcheck_script" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_create_tc_blocks_data" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_create_tc_tabledata" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_luteditor_script" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_prelookup_script" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_sweeptable_thd" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_tableplot_comet" , "toolbox/simulink/simdemos/simfeatures/"; + "sldemo_wavethd_script" , "toolbox/simulink/simdemos/simfeatures/"; + "sldiagnostics" , "toolbox/simulink/simulink/"; + "sldiscmdl" , "toolbox/simulink/components/"; + "sldiscutil" , "toolbox/simulink/components/"; + "sldrop" , "toolbox/simulink/simulink/private/"; + "sldsmemdlg" , "toolbox/simulink/blocks/"; + "slexist" , "toolbox/simulink/simulink/"; + "slexplr" , "toolbox/simulink/simulink/"; + "slfind" , "toolbox/simulink/simulink/"; + "slfromdlg" , "toolbox/simulink/blocks/"; + "slgetcompilerinfo" , "toolbox/simulink/simulink/private/"; + "slgotodlg" , "toolbox/simulink/blocks/"; + "slhelp" , "toolbox/simulink/simulink/"; + "slideg" , "toolbox/simulink/simulink/"; + "slidentinit" , "toolbox/ident/ident/"; + "slidentinit" , "toolbox/ident/idutils/"; + "slight" , "toolbox/simulink/simdemos/simgeneral/"; + "slinstallprefs" , "toolbox/simulink/simulink/"; + "sllastdiagnostic" , "toolbox/simulink/simulink/"; + "sllasterror" , "toolbox/simulink/simulink/"; + "sllastwarning" , "toolbox/simulink/simulink/"; + "slloadpmmenuitems" , "toolbox/simulink/simulink/"; + "sllsbox" , "toolbox/optim/private/"; + "slmaskprmdispcntrl" , "toolbox/simulink/simulink/"; + "slmdldisc" , "toolbox/simulink/components/"; + "slmdldiscui" , "toolbox/simulink/components/"; + "slmodelprop" , "toolbox/simulink/simulink/"; + "slmodelpropj" , "toolbox/simulink/simulink/"; + "slowfast" , "toolbox/robust/"; + "slpmloadfunction" , "toolbox/simulink/simulink/private/"; + "slprivate" , "toolbox/simulink/simulink/"; + "slproductinstalled" , "toolbox/simulink/simulink/"; + "slprofile_hilite_system" , "toolbox/simulink/simulink/"; + "slprofile_unhilite_system" , "toolbox/simulink/simulink/"; + "slprofreport" , "toolbox/simulink/simulink/"; + "slprophelp" , "toolbox/simulink/simulink/"; + "slreplace" , "toolbox/shared/dastudio/"; + "slresolveporthandle" , "toolbox/simulink/simulink/"; + "slroot" , "toolbox/simulink/simulink/"; + "slsaveas" , "toolbox/simulink/simulink/"; + "slsaveassup" , "toolbox/simulink/simulink/"; + "slsf" , "toolbox/stateflow/stateflow/private/"; + "slsfnagctlr" , "toolbox/simulink/simulink/"; + "slsigpropdlg" , "toolbox/simulink/simulink/"; + "slsnr" , "toolbox/shared/dastudio/"; + "sltbldesigner" , "toolbox/simulink/blocks/"; + "sltbledit" , "toolbox/simulink/blocks/"; + "sltipalert" , "toolbox/simulink/simulink/"; + "sltranslate" , "toolbox/simulink/simulink/"; + "sltrdemo" , "toolbox/robust/"; + "sluigeom" , "toolbox/simulink/simulink/"; + "sluiutil" , "toolbox/simulink/simulink/"; + "slupdate" , "toolbox/simulink/simulink/"; + "slvblk" , "toolbox/splines/"; + "slview" , "toolbox/control/control/"; + "slwsprmattrib" , "toolbox/simulink/simulink/"; + "smreal" , "toolbox/control/ctrlutil/"; + "snls" , "toolbox/optim/private/"; + "solve" , "toolbox/symbolic/"; + "sort_exported_fcns_info" , "toolbox/stateflow/stateflow/private/"; + "sorted" , "toolbox/splines/"; + "sos2cell" , "toolbox/signal/signal/"; + "sos2ss" , "toolbox/signal/signal/"; + "sos2tf" , "toolbox/signal/signal/"; + "sos2zp" , "toolbox/signal/signal/"; + "sosdemo" , "toolbox/signal/sigdemos/"; + "sosfilt" , "toolbox/signal/signal/"; + "sp2bb" , "toolbox/splines/"; + "sp2pp" , "toolbox/splines/"; + "spa" , "toolbox/ident/ident/"; + "spafdr" , "toolbox/ident/ident/"; + "spalldem" , "toolbox/splines/"; + "spap2" , "toolbox/splines/"; + "spapi" , "toolbox/splines/"; + "spapidem" , "toolbox/splines/"; + "spaps" , "toolbox/splines/"; + "spbrk" , "toolbox/splines/"; + "spchart" , "toolbox/control/ctrlguis/"; + "spcol" , "toolbox/splines/"; + "spcrv" , "toolbox/splines/"; + "spcrvdem" , "toolbox/splines/"; + "spdialog" , "toolbox/simulink/simulink/"; + "specgram" , "toolbox/signal/signal/"; + "specgramdemo" , "toolbox/signal/sigdemos/"; + "specplot" , "toolbox/signal/signal/"; + "spectralanalysisobjsdemo" , "toolbox/signal/sigdemos/"; + "spectrum" , "toolbox/signal/signal/"; + "spectview" , "toolbox/signal/sptoolgui/"; + "speditline" , "toolbox/signal/sptoolgui/private/"; + "sphelpstr" , "toolbox/signal/sptoolgui/private/"; + "spinit" , "toolbox/signal/sptoolgui/private/"; + "spldems" , "toolbox/splines/"; + "splexmpl" , "toolbox/splines/"; + "splinetool" , "toolbox/splines/"; + "splitText" , "toolbox/simulink/simulink/private/"; + "splpp" , "toolbox/splines/"; + "spmak" , "toolbox/splines/"; + "spmethp" , "toolbox/signal/sptoolgui/private/"; + "spmotion" , "toolbox/signal/sptoolgui/private/"; + "spresize" , "toolbox/signal/sptoolgui/private/"; + "sprfn" , "toolbox/splines/"; + "spriorityfcn" , "toolbox/simulink/simdemos/simfeatures/"; + "sprpp" , "toolbox/splines/"; + "sptarn" , "toolbox/pde/"; + "sptcompp" , "toolbox/signal/sptoolgui/private/"; + "spterms" , "toolbox/splines/"; + "sptexport" , "toolbox/signal/sptoolgui/private/"; + "sptfileheader" , "toolbox/signal/sigtools/"; + "spthelp" , "toolbox/signal/sptoolgui/private/"; + "spthelpstr" , "toolbox/signal/sptoolgui/private/"; + "sptimport" , "toolbox/signal/sptoolgui/private/"; + "sptlegend" , "toolbox/signal/sptoolgui/private/"; + "sptlinetip" , "toolbox/signal/sigtools/"; + "sptool" , "toolbox/signal/sptoolgui/"; + "sptool_helpmenu" , "toolbox/signal/sptoolgui/private/"; + "sptprefp" , "toolbox/signal/sptoolgui/private/"; + "sptprefs" , "toolbox/signal/sptoolgui/private/"; + "sptrmcharsfromcell" , "toolbox/signal/sigtools/"; + "sptsizes" , "toolbox/signal/sptoolgui/private/"; + "spval" , "toolbox/splines/"; + "spzoom" , "toolbox/signal/sptoolgui/private/"; + "sqpbox" , "toolbox/optim/private/"; + "sqpmin" , "toolbox/optim/private/"; + "sqrmtx" , "toolbox/robust/"; + "square" , "toolbox/signal/signal/"; + "squareb1" , "toolbox/pde/"; + "squareb2" , "toolbox/pde/"; + "squareb3" , "toolbox/pde/"; + "squareb4" , "toolbox/pde/"; + "squareb5" , "toolbox/pde/"; + "squareform" , "toolbox/stats/"; + "squareg" , "toolbox/pde/"; + "sroproject" , "toolbox/sloptim/sloptim/"; + "srotut1_dat" , "toolbox/sloptim/sloptdemos/"; + "ss2sos" , "toolbox/signal/signal/"; + "ss2ss" , "toolbox/control/control/"; + "ss2th" , "toolbox/ident/idobsolete/"; + "ssdelete" , "toolbox/control/ctrlobsolete/"; + "ssfreqresp" , "toolbox/ident/idutils/"; + "ssfrupd" , "toolbox/ident/idutils/private/"; + "ssinthd" , "toolbox/simulink/simdemos/simfeatures/"; + "ssinv" , "toolbox/robust/"; + "ssmodxx" , "toolbox/ident/idutils/"; + "ssops" , "toolbox/control/ctrlutil/"; + "ssselect" , "toolbox/control/ctrlobsolete/"; + "ssssaux" , "toolbox/ident/idutils/"; + "ssv" , "toolbox/robust/"; + "stabproj" , "toolbox/robust/"; + "start_simulation" , "toolbox/stateflow/stateflow/private/"; + "startupdlg" , "toolbox/control/ctrlguis/"; + "startupsav" , "toolbox/local/"; + "startx" , "toolbox/shared/optimlib/"; + "statchol" , "toolbox/stats/private/"; + "statctexact" , "toolbox/stats/private/"; + "statdisptable" , "toolbox/stats/"; + "state2html" , "toolbox/stateflow/stateflow/private/"; + "state_print_fig" , "toolbox/stateflow/stateflow/private/"; + "stateddg" , "toolbox/stateflow/stateflow/private/"; + "statedlg" , "toolbox/stateflow/stateflow/private/"; + "stateflow" , "toolbox/stateflow/stateflow/"; + "statepropdialog" , "toolbox/simulink/simulink/"; + "statget" , "toolbox/stats/"; + "statgetargs" , "toolbox/stats/private/"; + "statgetargsuser" , "toolbox/stats/private/"; + "statgetcolor" , "toolbox/stats/private/"; + "statglmeval" , "toolbox/stats/private/"; + "staticres" , "toolbox/signal/sigtools/"; + "staticrespengine" , "toolbox/signal/sigtools/"; + "statinsertnan" , "toolbox/stats/private/"; + "statremovenan" , "toolbox/stats/private/"; + "statrobustfit" , "toolbox/stats/private/"; + "statset" , "toolbox/stats/"; + "statsfminbx" , "toolbox/stats/private/"; + "statsizechk" , "toolbox/stats/private/"; + "statsrexact" , "toolbox/stats/private/"; + "stattestlink" , "toolbox/stats/private/"; + "stbrk" , "toolbox/splines/"; + "stcol" , "toolbox/splines/"; + "std2" , "toolbox/images/images/"; + "stdrcdf" , "toolbox/stats/private/"; + "stdrinv" , "toolbox/stats/private/"; + "stealparameter" , "toolbox/simulink/fixedandfloat/"; + "step" , "toolbox/control/control/"; + "stepfun" , "toolbox/control/ctrlobsolete/"; + "stepwise" , "toolbox/stats/"; + "stepwisefit" , "toolbox/stats/"; + "stepz" , "toolbox/signal/signal/"; + "stf2target" , "toolbox/rtw/rtw/"; + "stf2tc" , "toolbox/shared/dastudio/"; + "stf4target" , "toolbox/rtw/rtw/"; + "stfInitTarget" , "toolbox/rtw/rtw/"; + "stfTargetDlgCallback" , "toolbox/simulink/simulink/private/"; + "stftarget_fillstring" , "toolbox/rtw/rtw/"; + "stmak" , "toolbox/splines/"; + "stmcb" , "toolbox/signal/signal/"; + "stop_simulation" , "toolbox/stateflow/stateflow/private/"; + "stowe_away_tlc_logs_for_testing" , "toolbox/rtw/rtw/"; + "stradd" , "toolbox/stateflow/stateflow/private/"; + "strcat_with_separator" , "toolbox/simulink/simulink/private/"; + "strelcheck" , "toolbox/images/images/private/"; + "stretchlim" , "toolbox/images/images/"; + "strip_path_from_name" , "toolbox/stateflow/stateflow/private/"; + "strip_trailing_new_lines" , "toolbox/stateflow/coder/private/"; + "strips" , "toolbox/signal/signal/"; + "strlen" , "toolbox/stateflow/stateflow/private/"; + "strlines" , "toolbox/stateflow/stateflow/private/"; + "strlong" , "toolbox/stateflow/stateflow/private/"; + "strrows" , "toolbox/stateflow/stateflow/private/"; + "struc" , "toolbox/ident/ident/"; + "struct2array" , "toolbox/signal/sigtools/"; + "structelementddg" , "toolbox/simulink/simulink/"; + "structtypeddg" , "toolbox/simulink/simulink/"; + "strwrite" , "toolbox/stateflow/stateflow/private/"; + "stval" , "toolbox/splines/"; + "subaxes" , "toolbox/control/ctrlobsolete/"; + "subimage" , "toolbox/images/images/"; + "subplus" , "toolbox/splines/"; + "subs" , "toolbox/symbolic/"; + "subsystem_configuration" , "toolbox/simulink/simulink/"; + "subsystem_configuration_blkinit" , "toolbox/simulink/simulink/"; + "subsystem_to_model_reference" , "toolbox/simulink/simulink/private/"; + "sum4vms" , "toolbox/ident/idutils/"; + "sumblock" , "toolbox/control/ctrldemos/private/"; + "sumboard" , "toolbox/ident/idguis/"; + "super_checker" , "toolbox/stateflow/stateflow/private/"; + "surfht" , "toolbox/stats/"; + "survivaldemo" , "toolbox/stats/"; + "suspdat" , "toolbox/simulink/simdemos/automotive/"; + "suspgrph" , "toolbox/simulink/simdemos/automotive/"; + "svburg" , "toolbox/signal/sptoolgui/private/"; + "svcov" , "toolbox/signal/sptoolgui/private/"; + "svextrap" , "toolbox/signal/sptoolgui/private/"; + "svfft" , "toolbox/signal/sptoolgui/private/"; + "sviewer" , "toolbox/simulink/simulink/"; + "svmcov" , "toolbox/signal/sptoolgui/private/"; + "svmtm" , "toolbox/signal/sptoolgui/private/"; + "svmusic" , "toolbox/signal/sptoolgui/private/"; + "svwelch" , "toolbox/signal/sptoolgui/private/"; + "svyulear" , "toolbox/signal/sptoolgui/private/"; + "symbol_wiz" , "toolbox/stateflow/stateflow/private/"; + "symcalcdemo" , "toolbox/symbolic/"; + "symdemos" , "toolbox/symbolic/"; + "symeqndemo" , "toolbox/symbolic/"; + "symintro" , "toolbox/symbolic/"; + "symlindemo" , "toolbox/symbolic/"; + "symrotdemo" , "toolbox/symbolic/"; + "syms" , "toolbox/symbolic/"; + "symvpademo" , "toolbox/symbolic/"; + "syncDlgStopTimes" , "toolbox/simulink/simulink/"; + "sync_target" , "toolbox/stateflow/stateflow/private/"; + "sys2ss" , "toolbox/robust/"; + "sysardec" , "toolbox/ident/idutils/"; + "sysblock" , "toolbox/control/ctrldemos/private/"; + "sysdemo" , "toolbox/robust/"; + "sysirdec" , "toolbox/ident/idutils/"; + "sysmatrix" , "toolbox/signal/sigtools/"; + "tabulate" , "toolbox/stats/"; + "tagdialog" , "toolbox/simulink/simulink/"; + "target_code_flags" , "toolbox/stateflow/stateflow/private/"; + "target_methods" , "toolbox/stateflow/stateflow/private/"; + "target_name_change" , "toolbox/stateflow/stateflow/private/"; + "target_opts_ddg" , "toolbox/stateflow/stateflow/private/"; + "targetddg" , "toolbox/stateflow/stateflow/private/"; + "targetddg_btn_coder_cb" , "toolbox/stateflow/stateflow/private/"; + "targetddg_btn_target_cb" , "toolbox/stateflow/stateflow/private/"; + "targetddg_preapply_callback" , "toolbox/stateflow/stateflow/private/"; + "targetddg_preclose_callback" , "toolbox/stateflow/stateflow/private/"; + "targetdevicetypechanged" , "toolbox/simulink/simulink/"; + "targetdlg" , "toolbox/stateflow/stateflow/private/"; + "targetman" , "toolbox/stateflow/stateflow/private/"; + "taylortool" , "toolbox/symbolic/"; + "tbfillblanks" , "toolbox/signal/sptoolgui/private/"; + "tblpresrc" , "toolbox/simulink/simulink/private/"; + "tblread" , "toolbox/stats/"; + "tblwrite" , "toolbox/stats/"; + "tbroyfg" , "toolbox/optim/"; + "tcdf" , "toolbox/stats/"; + "tchop" , "toolbox/control/ctrlutil/"; + "tdfread" , "toolbox/stats/"; + "tdfthru" , "toolbox/control/ctrlutil/"; + "ted_the_editors" , "toolbox/stateflow/stateflow/private/"; + "termcross" , "toolbox/stats/private/"; + "test_points_in" , "toolbox/stateflow/stateflow/private/"; + "testing_stateflow_in_bat" , "toolbox/stateflow/stateflow/private/"; + "tf2latc" , "toolbox/signal/signal/"; + "tf2sos" , "toolbox/signal/signal/"; + "tf2zpk" , "toolbox/signal/signal/"; + "tfe" , "toolbox/signal/signal/"; + "tfestimate" , "toolbox/signal/signal/"; + "tffunc" , "toolbox/signal/sigdemos/"; + "tfm2ss" , "toolbox/robust/"; + "tform" , "toolbox/images/images/private/"; + "tformarray" , "toolbox/images/images/"; + "tformfwd" , "toolbox/images/images/"; + "tforminv" , "toolbox/images/images/"; + "th2arx" , "toolbox/ident/idobsolete/"; + "th2ff" , "toolbox/ident/idobsolete/"; + "th2ido" , "toolbox/ident/idobsolete/"; + "th2par" , "toolbox/ident/idobsolete/"; + "th2poly" , "toolbox/ident/idobsolete/"; + "th2ss" , "toolbox/ident/idobsolete/"; + "th2tf" , "toolbox/ident/idobsolete/"; + "th2zp" , "toolbox/ident/idobsolete/"; + "thc2thd" , "toolbox/ident/idobsolete/"; + "thd2thc" , "toolbox/ident/idobsolete/"; + "thermdat" , "toolbox/simulink/simdemos/simgeneral/"; + "thinit" , "toolbox/ident/idobsolete/"; + "this_is_an_sflink" , "toolbox/stateflow/stateflow/private/"; + "thss2th" , "toolbox/ident/idobsolete/"; + "tiedrank" , "toolbox/stats/"; + "timestwo" , "toolbox/simulink/blocks/"; + "timezparse" , "toolbox/signal/signal/"; + "timezplot" , "toolbox/signal/signal/private/"; + "timscale" , "toolbox/ident/idutils/private/"; + "timvec" , "toolbox/control/ctrlobsolete/"; + "tinv" , "toolbox/stats/"; + "titanium" , "toolbox/splines/"; + "title4ax" , "toolbox/signal/sigtools/"; + "tlc" , "toolbox/rtw/rtw/"; + "tlc2m" , "toolbox/rtw/rtw/"; + "tlc_c" , "toolbox/rtw/rtw/"; + "tlcsetup" , "toolbox/rtw/rtw/"; + "toast" , "toolbox/simulink/dee/"; + "toiletgui" , "toolbox/simulink/simdemos/simgeneral/"; + "toiletsfun" , "toolbox/simulink/simdemos/simgeneral/"; + "tokenize" , "toolbox/stateflow/stateflow/private/"; + "tokenize" , "toolbox/images/images/private/"; + "too_many_editors" , "toolbox/stateflow/stateflow/private/"; + "toolbox_path_cache" , "toolbox/local/"; + "topicshow" , "toolbox/control/ctrldemos/private/"; + "tornado_callback_handler" , "toolbox/rtw/rtw/"; + "tpaps" , "toolbox/splines/"; + "tpdf" , "toolbox/stats/"; + "transddg" , "toolbox/stateflow/stateflow/private/"; + "transdlg" , "toolbox/stateflow/stateflow/private/"; + "transf" , "toolbox/ident/idutils/"; + "translate_io_size_mismatch_error" , "toolbox/stateflow/stateflow/private/"; + "trdg" , "toolbox/optim/private/"; + "trdog" , "toolbox/optim/private/"; + "tree" , "toolbox/robust/"; + "treedisp" , "toolbox/stats/"; + "treefit" , "toolbox/stats/"; + "treeprune" , "toolbox/stats/"; + "treetest" , "toolbox/stats/"; + "treeval" , "toolbox/stats/"; + "treeview" , "toolbox/simulink/simulink/"; + "trf" , "toolbox/ident/idobsolete/"; + "tri2grid" , "toolbox/pde/"; + "triang" , "toolbox/signal/signal/"; + "tridieig" , "toolbox/signal/signal/private/"; + "tridisolve" , "toolbox/signal/signal/private/"; + "trim" , "toolbox/simulink/simulink/"; + "trimfcn" , "toolbox/simulink/simulink/"; + "trimmean" , "toolbox/stats/"; + "tripuls" , "toolbox/signal/signal/"; + "trnd" , "toolbox/stats/"; + "truesize" , "toolbox/images/images/"; + "trust" , "toolbox/optim/private/"; + "trustnleqn" , "toolbox/optim/private/"; + "truth_table_handle_man" , "toolbox/stateflow/stateflow/private/"; + "truth_table_man" , "toolbox/stateflow/stateflow/private/"; + "truth_tables_in" , "toolbox/stateflow/stateflow/private/"; + "try_indenting_file" , "toolbox/stateflow/coder/private/"; + "tsAlignSizes" , "toolbox/shared/timeseries/"; + "tsChkTime" , "toolbox/shared/timeseries/"; + "tsIsDateFormat" , "toolbox/shared/timeseries/"; + "tsParseInputs" , "toolbox/shared/timeseries/"; + "tsarrayFcn" , "toolbox/shared/timeseries/"; + "tsdateinterval" , "toolbox/shared/timeseries/"; + "tsinterp" , "toolbox/shared/timeseries/"; + "tspdem" , "toolbox/splines/"; + "tss" , "toolbox/robust/private/"; + "tssdata" , "toolbox/robust/private/"; + "tssorttime" , "toolbox/shared/timeseries/"; + "tstat" , "toolbox/stats/"; + "tsunitconv" , "toolbox/shared/timeseries/"; + "tt_check_specification" , "toolbox/stateflow/stateflow/private/"; + "ttest" , "toolbox/stats/"; + "ttest2" , "toolbox/stats/"; + "tukeywin" , "toolbox/signal/signal/"; + "tunable_param_dlg" , "toolbox/simulink/simulink/"; + "tunablevars2parameterobjects" , "toolbox/simulink/simulink/"; + "tutdemo" , "toolbox/optim/"; + "type2pp" , "toolbox/ident/idutils/"; + "tzero2" , "toolbox/control/ctrlobsolete/"; + "udd_property_help" , "toolbox/stateflow/stateflow/private/"; + "uddpvparse" , "toolbox/signal/sigtools/"; + "udecode" , "toolbox/signal/signal/"; + "uencode" , "toolbox/signal/signal/"; + "ufix" , "toolbox/simulink/fixedandfloat/"; + "ufrac" , "toolbox/simulink/fixedandfloat/"; + "uget_param" , "toolbox/simulink/simulink/"; + "uint" , "toolbox/simulink/fixedandfloat/"; + "uintlut" , "toolbox/images/images/"; + "unencrypted_charts_in" , "toolbox/stateflow/stateflow/private/"; + "unfixpar" , "toolbox/ident/idobsolete/"; + "unidcdf" , "toolbox/stats/"; + "unidinv" , "toolbox/stats/"; + "unidpdf" , "toolbox/stats/"; + "unidrnd" , "toolbox/stats/"; + "unidstat" , "toolbox/stats/"; + "unifcdf" , "toolbox/stats/"; + "unifinv" , "toolbox/stats/"; + "unifit" , "toolbox/stats/"; + "unifpdf" , "toolbox/stats/"; + "unifrnd" , "toolbox/stats/"; + "unifstat" , "toolbox/stats/"; + "uniqlabel" , "toolbox/signal/sptoolgui/private/"; + "uniqname" , "toolbox/control/ctrlguis/"; + "unique_name_for_list" , "toolbox/stateflow/stateflow/private/"; + "unitconv" , "toolbox/control/ctrlguis/"; + "unpack_machine_id" , "toolbox/stateflow/stateflow/private/"; + "unshiftdata" , "toolbox/signal/signal/"; + "unshsca" , "toolbox/optim/private/"; + "unstkc" , "toolbox/robust/"; + "unstkr" , "toolbox/robust/"; + "update_assert_sys" , "toolbox/simulink/blocks/"; + "update_eml_data" , "toolbox/stateflow/stateflow/private/"; + "update_exported_fcn_info" , "toolbox/stateflow/stateflow/private/"; + "update_fvtool" , "toolbox/signal/sptoolgui/private/"; + "update_library_link_charts_for_rtw" , "toolbox/stateflow/stateflow/private/"; + "update_model_reference_targets" , "toolbox/simulink/simulink/private/"; + "update_params_on_instances" , "toolbox/stateflow/stateflow/private/"; + "update_rtb" , "toolbox/simulink/blocks/"; + "update_statusbar" , "toolbox/signal/sigtools/"; + "update_toolbox_cache" , "toolbox/local/"; + "update_truth_table_for_fcn" , "toolbox/stateflow/stateflow/private/"; + "update_truth_tables" , "toolbox/stateflow/stateflow/private/"; + "update_truthtable_data" , "toolbox/stateflow/stateflow/private/"; + "updatewarn" , "toolbox/control/ctrlutil/"; + "updownsample" , "toolbox/signal/signal/private/"; + "upfind" , "toolbox/stateflow/stateflow/private/"; + "upfirdn" , "toolbox/signal/signal/"; + "upsample" , "toolbox/signal/signal/"; + "upvpl2xyz" , "toolbox/images/images/private/"; + "userpath" , "toolbox/local/"; + "uset_param" , "toolbox/simulink/simulink/"; + "utAssignParams" , "toolbox/sloptim/sloptguis/"; + "utEvalModelVar" , "toolbox/sloptim/sloptguis/"; + "utEvalParams" , "toolbox/sloptim/sloptguis/"; + "utFindLog" , "toolbox/sloptim/sloptim/"; + "utFindParams" , "toolbox/sloptim/sloptguis/"; + "utFindProject" , "toolbox/sloptim/sloptguis/"; + "utGetLastError" , "toolbox/sloptim/sloptguis/"; + "utGetLogData" , "toolbox/sloptim/sloptim/"; + "utGetSimInterval" , "toolbox/sloptim/sloptguis/"; + "utLoadProject" , "toolbox/sloptim/sloptguis/"; + "utSROCopyFcn" , "toolbox/sloptim/sloptguis/"; + "utgetaxes" , "toolbox/shared/timeseries/"; + "uvl2xyz" , "toolbox/images/images/private/"; + "v2sort" , "toolbox/shared/optimlib/"; + "validarg" , "toolbox/signal/sptoolgui/private/"; + "valve" , "toolbox/control/ctrldemos/private/"; + "vco" , "toolbox/signal/signal/"; + "vdlmintm" , "toolbox/simulink/blocks/"; + "vdpdemo" , "toolbox/simulink/simdemos/simgeneral/"; + "vdpm" , "toolbox/simulink/blocks/"; + "version" , "toolbox/local/"; + "vhdlplugin" , "toolbox/signal/sigtools/"; + "view_mdlrefs" , "toolbox/simulink/simulink/"; + "viewimportfcn" , "toolbox/control/ctrlguis/"; + "viewlinkdata" , "toolbox/simulink/simulink/"; + "vlimintm" , "toolbox/simulink/blocks/"; + "vpa" , "toolbox/symbolic/"; + "vratio" , "toolbox/signal/signal/"; + "vrsys" , "toolbox/robust/"; + "vset" , "toolbox/stateflow/stateflow/private/"; + "vsfunc" , "toolbox/simulink/blocks/"; + "waitbar" , "toolbox/stateflow/stateflow/private/"; + "walk" , "toolbox/stateflow/stateflow/private/"; + "warp" , "toolbox/images/images/"; + "watchsigsdlg" , "toolbox/simulink/simulink/"; + "watershed" , "toolbox/images/images/"; + "watertankdat" , "toolbox/slcontrol/slctrldemos/"; + "waveformdemo" , "toolbox/signal/sigdemos/"; + "wblcdf" , "toolbox/stats/"; + "wblfit" , "toolbox/stats/"; + "wblinv" , "toolbox/stats/"; + "wbllike" , "toolbox/stats/"; + "wblpdf" , "toolbox/stats/"; + "wblplot" , "toolbox/stats/"; + "wblrnd" , "toolbox/stats/"; + "wblstat" , "toolbox/stats/"; + "wbound" , "toolbox/pde/"; + "weibcdf" , "toolbox/stats/"; + "weibfit" , "toolbox/stats/"; + "weibinv" , "toolbox/stats/"; + "weiblike" , "toolbox/stats/"; + "weibpdf" , "toolbox/stats/"; + "weibplot" , "toolbox/stats/"; + "weibrnd" , "toolbox/stats/"; + "weibstat" , "toolbox/stats/"; + "welch" , "toolbox/signal/signal/private/"; + "wgeom" , "toolbox/pde/"; + "wgtnormfit" , "toolbox/stats/"; + "wgtnormfit2" , "toolbox/stats/"; + "wheel" , "toolbox/robust/"; + "whitepoint" , "toolbox/images/images/"; + "wiener2" , "toolbox/images/images/"; + "window" , "toolbox/signal/signal/"; + "windowstrs2fcnnames" , "toolbox/signal/sigtools/private/"; + "windtrandemo" , "toolbox/signal/sigdemos/"; + "winintegrate" , "toolbox/signal/sigdemos/private/"; + "winorderfirst" , "toolbox/signal/sigdemos/private/"; + "wintool" , "toolbox/signal/sigtools/"; + "wintool_help" , "toolbox/signal/sigtools/"; + "wire" , "toolbox/control/ctrldemos/private/"; + "wishrnd" , "toolbox/stats/"; + "workspaceddg" , "toolbox/simulink/simulink/"; + "workspaceddg_cb" , "toolbox/simulink/simulink/"; + "ws2matq" , "toolbox/pde/private/"; + "wvtool" , "toolbox/signal/sigtools/"; + "x0est" , "toolbox/ident/idutils/private/"; + "x0est_f" , "toolbox/ident/idutils/"; + "x2fx" , "toolbox/stats/"; + "xbarplot" , "toolbox/stats/"; + "xcorr" , "toolbox/signal/signal/"; + "xcorr2" , "toolbox/signal/signal/"; + "xcov" , "toolbox/signal/signal/"; + "xlabel4ax" , "toolbox/signal/sigtools/"; + "xpbanplt" , "toolbox/optim/"; + "xplot" , "toolbox/optim/private/"; + "xtrack" , "toolbox/optim/private/"; + "xyl2xyz" , "toolbox/images/images/private/"; + "xyz2double" , "toolbox/images/images/"; + "xyz2lab" , "toolbox/images/images/private/"; + "xyz2uint16" , "toolbox/images/images/"; + "xyz2upvpl" , "toolbox/images/images/private/"; + "xyz2uvl" , "toolbox/images/images/private/"; + "xyz2xyl" , "toolbox/images/images/private/"; + "ycbcr2rgb" , "toolbox/images/images/"; + "ydataspan" , "toolbox/control/ctrlguis/"; + "ylabel4ax" , "toolbox/signal/sigtools/"; + "ylwk" , "toolbox/robust/"; + "youla" , "toolbox/robust/"; + "yulewalk" , "toolbox/signal/signal/"; + "zerophase" , "toolbox/signal/signal/"; + "zeta" , "toolbox/symbolic/"; + "zfcheck" , "toolbox/ident/idutils/"; + "zgrid" , "toolbox/control/control/"; + "zoom_cbs" , "toolbox/signal/sigtools/private/"; + "zp" , "toolbox/ident/idobsolete/"; + "zp2sos" , "toolbox/signal/signal/"; + "zpchart" , "toolbox/control/ctrlguis/"; + "zpform" , "toolbox/ident/idobsolete/"; + "zplane" , "toolbox/signal/signal/"; + "zplaneplot" , "toolbox/signal/signal/"; + "zpplot" , "toolbox/ident/idobsolete/"; + "zscore" , "toolbox/stats/"; + "ztest" , "toolbox/stats/"] + k=find(namefun==tb(:,1)) + if k<>[] then + mtlbpath=tb(k,2) + ismtlb=%t + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/mtlbtree2sci.bin b/modules/m2sci/macros/kernel/mtlbtree2sci.bin Binary files differnew file mode 100755 index 000000000..02fd232a1 --- /dev/null +++ b/modules/m2sci/macros/kernel/mtlbtree2sci.bin diff --git a/modules/m2sci/macros/kernel/mtlbtree2sci.sci b/modules/m2sci/macros/kernel/mtlbtree2sci.sci new file mode 100755 index 000000000..4748eecc9 --- /dev/null +++ b/modules/m2sci/macros/kernel/mtlbtree2sci.sci @@ -0,0 +1,125 @@ +// 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 [scitree,crp]=mtlbtree2sci(mtlbtree,prettyprintoutput) + // Conversion of a Matlab function tree to Scilab (and code generation) + // Input arguments: + // - mtlbtree: tree (returned by macr2tree) representing Matlab function compiled code + // - prettyprintoutput: boolean flag for pretty printed output file if TRUE + // Output arguments: + // - scitree: Scilab equivalent for mtlbtree + // - crp: Scilab equivalent function code (function body) + + // Global variables for M2SCI + global("m2sci_to_insert_b") // To insert before current instruction + global("m2sci_to_insert_a") // To insert after current instruction + global("tmpvarnb") // Index for temporary variables + m2sci_to_insert_b=list() + m2sci_to_insert_a=list() + tmpvarnb=0 + + if typeof(mtlbtree)<>"program" then + error(gettext("wrong type of input.")) + end + + // Init Scilab tree + scitree=tlist(["program","name","outputs","inputs","statements"],mtlbtree.name,mtlbtree.outputs,mtlbtree.inputs,list()) + + ninstr=1 // Index of Matlab tree + if batch then // defined in m2sci.sci + nblines=0 + else + nblines=1 // Number of converted lines + end + + m2sci_info(gettext("Conversion of M-tree..."),-1); + + // Default value + rhs = argn(2); + if rhs<2 then + prettyprintoutput=%F + end + + crp="" + + // Function prototype + lhsstr=[] + rhsstr=[] + if scitree.name<>"" then // Not a batch file + for k=1:size(scitree.outputs) + lhsstr=[lhsstr,expression2code(scitree.outputs(k))] + end + lhsstr="["+strcat(lhsstr,",")+"]" + + for k=1:size(scitree.inputs) + rhsstr=[rhsstr,expression2code(scitree.inputs(k))] + end + rhsstr="("+strcat(rhsstr,",")+")" + + crp=lhsstr+" = "+scitree.name+rhsstr; + end + + // Convert Matlab instruction tree to Scilab + while ninstr<=size(mtlbtree.statements)-3 + //Case : sup_equal instruction + // Add converted tree to scitree and also inserted instructions + if typeof(mtlbtree.statements(ninstr))=="sup_equal" + + sci_stat=list() + for i=1:size(mtlbtree.statements(ninstr).sup_instr) + [converted_tree,nblines]=instruction2sci(mtlbtree.statements(ninstr).sup_instr(i),nblines) + + sci_stat=update_instr_list(sci_stat,converted_tree) + end + + scitree.statements($+1)=tlist(["sup_equal","sup_instr","nb_opr"],sci_stat,mtlbtree.statements(ninstr).nb_opr) + else + + [converted_tree,nblines]=instruction2sci(mtlbtree.statements(ninstr),nblines) + + // Add converted tree to scitree and also inserted instructions + + scitree.statements=update_instr_list(scitree.statements,converted_tree) + + // Generate code corresponding to scitree.statements + end + for k=1:size(scitree.statements) + if k<size(scitree.statements) + crp = cat_code(crp,instruction2code(scitree.statements(k),prettyprintoutput)); + crp = format_txt(crp,scitree.statements(k),prettyprintoutput,scitree.statements(k+1)); + end + end + + scitree.statements=list(scitree.statements($)) + + // Disp percentage of conversion done + msprintf(gettext("%s line %s out of %s..."),margin, string(nblines), string(mtlbtree.nblines)) + ninstr=ninstr+1 + tmpvarnb=0 + end + + if scitree.statements(1)<>list("EOL") then + crp = cat_code(crp,instruction2code(scitree.statements(1),prettyprintoutput)); + crp = format_txt(crp,scitree.statements(1),prettyprintoutput,list("EOL")); + end + + if scitree.name<>"" then // Not a batch file + crp=cat_code(crp,""); + crp=cat_code(crp,"endfunction"); // Replace last return + crp=cat_code(crp,""); + end + + m2sci_info(gettext("Conversion of M-tree: Done"),-1); + + + clearglobal("m2sci_to_insert_b") + clearglobal("m2sci_to_insert_a") + clearglobal("tmpvarnb") + +endfunction diff --git a/modules/m2sci/macros/kernel/multi_fun_file.bin b/modules/m2sci/macros/kernel/multi_fun_file.bin Binary files differnew file mode 100755 index 000000000..a2e3c915d --- /dev/null +++ b/modules/m2sci/macros/kernel/multi_fun_file.bin diff --git a/modules/m2sci/macros/kernel/multi_fun_file.sci b/modules/m2sci/macros/kernel/multi_fun_file.sci new file mode 100755 index 000000000..7e427e098 --- /dev/null +++ b/modules/m2sci/macros/kernel/multi_fun_file.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 bval=multi_fun_file(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + // This function converts M-Files containing more than one functio + // Inputs are the same as mfile2sci() + // Outputs : + // - bval: boolean value, %t if file contains more than on function, %f else + + sciparam(); + + // File name + k=strindex(fil,".") + if k<>[] + ke=k($)-1 + base_name=part(fil,1:ke) + else + ke=length(fil) + base_name=fil + end + // File path + k=strindex(fil,"/") + if k==[] then + file_path="./" + else + file_path=part(fil,1:k($)) + end + base_name=part(base_name,k($)+1:ke) + + txt=mgetl(fil); + + kf=grep(txt,["function[","function "]) + + if isempty(kf) then + // Batch file + bval=%f + elseif size(kf,"*")==1 then + // Only one function defined + bval=%f + else + funcdecl=[] + for kk=kf + ind=strindex(txt(kk),["function[";"function "]) + if isacomment(txt(kk))==0 & ~isinstring(txt(kk),ind) & part(stripblanks(txt(kk),%T),1:8)=="function" then // function prototype + funcdecl=[funcdecl kk] + end + end + + if isempty(funcdecl) then + // "function" only exists in comments and strings + bval=%f + return + elseif size(funcdecl,"*")==1 then + bval=%f + return + end + + // Verify if the directory exists + dirnam = ls(pathconvert(TMPDIR)+base_name); + + sep = filesep(); + + if or(dirnam<>"") then + rmdir(pathconvert(TMPDIR)+base_name,"s") + end + mkdir(pathconvert(TMPDIR),base_name) + write(%io(2),msprintf(gettext(" -- File %s contains more than one function -- "),fil)); + + bval= %t + + // First split file into as many files as function declared + funcdecl=[funcdecl size(txt,"*")+1] + + tmpfiles=[] + for k=1:size(funcdecl,"*")-1 + functxt=txt(funcdecl(k):funcdecl(k+1)-1) + str= strindex(txt(funcdecl(k)),"(")-1 + if str==-1 then + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:length(txt(funcdecl(k))))) + else + funcname=stripblanks(part(txt(funcdecl(k)),strindex(txt(funcdecl(k)),["function[","function "])+8:str(1))) + end + + keq=strindex(funcname,"=") + if ~isempty(keq) then + funcname=stripblanks(part(funcname,keq+1:length(funcname))) + end + tmpfiles=[tmpfiles;funcname] + mputl(functxt,pathconvert(TMPDIR)+base_name+sep+tmpfiles($)+".m"); + end + + write(%io(2),msprintf(gettext(" -- Each function converted separately: %s -- "),strcat(tmpfiles," "))); + write(%io(2),msprintf(gettext(" -- Temporary files put in: %s -- "),pathconvert(TMPDIR))); + + // Conversion of each file + + for k=1:size(tmpfiles,"*") + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+tmpfiles(k)+".m") + //mfile2sci(pathconvert(TMPDIR)+tmpfiles(k)+".m",res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + end + + translatepaths(pathconvert(TMPDIR)+base_name,pathconvert(TMPDIR)+base_name) + + txt=[] + if isfile(pathconvert(TMPDIR)+base_name+sep+"log") then + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+"log") + end + mputl(txt,res_path+"log"); + if isfile(pathconvert(TMPDIR)+base_name+sep+"resumelog") then + txt=mgetl(pathconvert(TMPDIR)+base_name+sep+"resumelog") + end + mputl(txt,res_path+"resumelog"); + + // Catenation of all .sci files to have only one output file + txt=[] + for k=1:size(tmpfiles,"*") + txt=[txt ;"";mgetl(pathconvert(TMPDIR)+base_name+sep+tmpfiles(k)+".sci")] + end + + // Delete useless .sci files + //for k=1:size(tmpfiles,"*") + //mdelete(res_path+tmpfiles(k)+".sci") + //end + + mputl(txt,res_path+base_name+".sci"); + + // Catenation of all .log files to have only one output file + //if exists("logfile")==0 then + //txt=[] + //for k=1:size(tmpfiles,"*") + //txt=[txt ; mgetl(pathconvert(TMPDIR)+base_name+sep+"m2sci_"+tmpfiles(k)+".log")] + //end + + // Delete useless .log files + //for k=1:size(tmpfiles,"*") + //mdelete(pathconvert(TMPDIR)+base_name+sep+"m2sci_"+tmpfiles(k)+".log") + //end + + //mputl(txt,res_path+"m2sci_"+base_name+".log"); + //end + + // Catenation of all resume.log files to have only one output file + //if exists("resume_logfile")==0 then + //txt=[] + //for k=1:size(tmpfiles,"*") + //txt=[txt ; mgetl(res_path+"m2sci_"+tmpfiles(k)+"_resume.log")] + //end + + // Delete useless _resume.log files + //for k=1:size(tmpfiles,"*") + //mdelete(res_path+"m2sci_"+tmpfiles(k)+"_resume.log") + //end + + //mputl(txt,res_path+"m2sci_"+base_name+"_resume.log"); + //end + + // Delete useless .m files + //for k=1:size(tmpfiles,"*") + //mdelete(pathconvert(TMPDIR)+tmpfiles(k)+".m") + //end + + rmdir(pathconvert(TMPDIR)+base_name,"s") + for k=1:size(tmpfiles,"*") + mdelete(pathconvert(TMPDIR)+tmpfiles(k)+".tree") + end + end + +endfunction diff --git a/modules/m2sci/macros/kernel/names b/modules/m2sci/macros/kernel/names new file mode 100755 index 000000000..42ef173b6 --- /dev/null +++ b/modules/m2sci/macros/kernel/names @@ -0,0 +1,87 @@ +%contents_i_funcall +%contents_i_operatio +%contents_i_variable +%cste_e +%funcall_6 +%funcall_e +%infer_i_s +%infer_i_st +%l_i_cste +%l_i_funcall +%l_i_operatio +%l_i_variable +%m2scivar_e +%operatio_6 +%operatio_e +%s_i_operatio +%s_i_variable +%type_i_cste +%type_i_funcall +%type_i_operatio +%type_i_variable +%variable_6 +%variable_e +Contents +Cste +Equal +Funcall +Infer +M2scivar +Operation +Rhs_tlist +Type +Variable +allunknown +changevarname +clause2sci +convert2double +default_trad +equal2sci +expression2sci +first_non_singleton +funcall2sci +funcallsearch +get_unknown +getoperands +getrhs +gettempvar +getvar2sci +i_notation +infer2txt +insert +instruction2sci +is_a_scalar +is_a_vector +is_complex +is_empty +is_real +isacomment +isanmfile +isdefinedvar +isinstring +lst_funcall +m2sci +m2sci_info +m2sci_syntax +mfile_path +mtlbtoolfun +mtlbtree2sci +multi_fun_file +no_equiv +not_a_scalar +not_a_vector +not_empty +not_yet_converted +old2newinstr +operation2sci +repl_poss +replace_brackets +sci_generic +sci_m2scideclare +sciparam +set_infos +transformtree +translateorder +update_instr_list +updatevarslist +variablesearch diff --git a/modules/m2sci/macros/kernel/no_equiv.bin b/modules/m2sci/macros/kernel/no_equiv.bin Binary files differnew file mode 100755 index 000000000..099620776 --- /dev/null +++ b/modules/m2sci/macros/kernel/no_equiv.bin diff --git a/modules/m2sci/macros/kernel/no_equiv.sci b/modules/m2sci/macros/kernel/no_equiv.sci new file mode 100755 index 000000000..92995848c --- /dev/null +++ b/modules/m2sci/macros/kernel/no_equiv.sci @@ -0,0 +1,14 @@ +// 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 []=no_equiv(expr) + + set_infos(msprintf(gettext("No Scilab equivalent for: %s"),expr),2) + +endfunction diff --git a/modules/m2sci/macros/kernel/not_a_scalar.bin b/modules/m2sci/macros/kernel/not_a_scalar.bin Binary files differnew file mode 100755 index 000000000..8fd43d990 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_scalar.bin diff --git a/modules/m2sci/macros/kernel/not_a_scalar.sci b/modules/m2sci/macros/kernel/not_a_scalar.sci new file mode 100755 index 000000000..e8411dff6 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_scalar.sci @@ -0,0 +1,24 @@ +// 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 r=not_a_scalar(A) + // M2SCI function + // Checks if at least one dimension of A is greater than 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be a scalar) + + nb=0 + for k=1:size(A.dims) + if A.dims(k)>1 | A.dims(k)==SupToOne then + nb=nb+1 + end + end + + r=nb<>0 +endfunction diff --git a/modules/m2sci/macros/kernel/not_a_vector.bin b/modules/m2sci/macros/kernel/not_a_vector.bin Binary files differnew file mode 100755 index 000000000..d9d230146 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_vector.bin diff --git a/modules/m2sci/macros/kernel/not_a_vector.sci b/modules/m2sci/macros/kernel/not_a_vector.sci new file mode 100755 index 000000000..c21b85a77 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_a_vector.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 r=not_a_vector(A) + // M2SCI function + // Checks if at least two dimensions of A are greater than 1 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be a vector) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)>1 | A.dims(k)==SupToOne then + nb=nb+1 + end + end + + r=nb>=2 +endfunction diff --git a/modules/m2sci/macros/kernel/not_empty.bin b/modules/m2sci/macros/kernel/not_empty.bin Binary files differnew file mode 100755 index 000000000..1ac782240 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_empty.bin diff --git a/modules/m2sci/macros/kernel/not_empty.sci b/modules/m2sci/macros/kernel/not_empty.sci new file mode 100755 index 000000000..bdb03e8e3 --- /dev/null +++ b/modules/m2sci/macros/kernel/not_empty.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 r=not_empty(A) + // M2SCI function + // Checks if no A dimension can be 0 + // Input: A = a M2SCI tlist + // Output: r = boolean value (true if A can not be an empty matrix) + + n=size(A.dims) + nb=0 + for k=1:n + if A.dims(k)>0 | A.dims(k)==SupToOne | A.dims(k)==NotNull then + nb=nb+1 + end + end + + r=nb>0 +endfunction diff --git a/modules/m2sci/macros/kernel/not_yet_converted.bin b/modules/m2sci/macros/kernel/not_yet_converted.bin Binary files differnew file mode 100755 index 000000000..0701bd1fb --- /dev/null +++ b/modules/m2sci/macros/kernel/not_yet_converted.bin diff --git a/modules/m2sci/macros/kernel/not_yet_converted.sci b/modules/m2sci/macros/kernel/not_yet_converted.sci new file mode 100755 index 000000000..98ef7052f --- /dev/null +++ b/modules/m2sci/macros/kernel/not_yet_converted.sci @@ -0,0 +1,1337 @@ +// 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 allnames=not_yet_converted() + allnames=["abcdchk"; + "accumarray"; + "acosd"; + "acotd"; + "acscd"; + "actxproxy"; + "adddatadlg"; + "addpath"; + "addpref"; + "addsubplot"; + "addtodate"; + "airfoil"; + "airy"; + "align"; + "alim"; + "allchild"; + "alpha"; + "alphamap"; + "amp1dae"; + "ancestor"; + "and"; + "annotation"; + "anondemo"; + "ardemo"; + "area"; + "arith"; + "arpackc"; + "arrayviewfunc"; + "asecd"; + "asind"; + "assignin"; + "atand"; + "audiodevinfo"; + "audioplayerreg"; + "audiorecorderreg"; + "audiouniquename"; + "auditcontents"; + "aufinfo"; + "auread"; + "automesh"; + "autumn"; + "auwrite"; + "avifinfo"; + "aviinfo"; + "aviread"; + "awtinvoke"; + "axes"; + "axescheck"; + "axlimdlg"; + "ballode"; + "bar"; + "bar3"; + "bar3h"; + "barh"; + "base2dec"; + "basicfitdatastat"; + "batonode"; + "bench"; + "besschk"; + "bessel"; + "bessela"; + "besselh"; + "betacore"; + "betainc"; + "betaln"; + "bicg"; + "bicgstab"; + "bin2dec"; + "binpatch"; + "bitand"; + "bitcmp"; + "bitget"; + "bitmax"; + "bitor"; + "bitset"; + "bitshift"; + "bitxor"; + "blkdiag"; + "bone"; + "brighten"; + "brussode"; + "btndown"; + "btngroup"; + "btnicon"; + "btnpress"; + "btnresize"; + "btnstate"; + "btnup"; + "bucky"; + "buckydem"; + "builtin"; + "burgersode"; + "bvp4c"; + "bvpget"; + "bvpinit"; + "bvpset"; + "bvpval"; + "bwcontr"; + "calendar"; + "callSoapService"; + "calllib"; + "camdolly"; + "cameramenu"; + "cameratoolbar"; + "camlight"; + "camlookat"; + "camorbit"; + "campan"; + "campos"; + "camproj"; + "camroll"; + "camrotate"; + "camtarget"; + "camup"; + "camva"; + "camzoom"; + "cart2pol"; + "cart2sph"; + "cast"; + "cat"; + "catch"; + "caxis"; + "cbedit"; + "cdf2rdf"; + "cdfinfo"; + "cdfread"; + "cdfwrite"; + "cell2struct"; + "celldisp"; + "cellfun"; + "cellplot"; + "census"; + "cgs"; + "changeseriestype"; + "checkSyntacticWarnings"; + "checkin"; + "checkinwin"; + "checkout"; + "checkoutwin"; + "cholinc"; + "cholupdate"; + "circshift"; + "ckdepfun"; + "clabel"; + "class"; + "cleanupcomment"; + "clearcase"; + "clg"; + "clipboard"; + "clruprop"; + "cmapeditor"; + "cmdispatch"; + "cmdlnbgn"; + "cmdlnend"; + "cmdlnwin"; + "cmoptsdialog"; + "code2html"; + "codec"; + "colamd"; + "colmmd"; + "colon"; + "colorbar"; + "colorcube"; + "colormap"; + "colormapeditor"; + "colornone"; + "colperm"; + "colstyle"; + "comet"; + "comet3"; + "commandhistory"; + "commandwindow"; + "compan"; + "compass"; + "complex"; + "computer"; + "cond"; + "condeig"; + "condest"; + "coneplot"; + "contentsrpt"; + "contour"; + "contour3"; + "contourc"; + "contourf"; + "contours"; + "contourslice"; + "contrast"; + "conv2"; + "convertdemostodom"; + "convhull"; + "convhulln"; + "convn"; + "cool"; + "copper"; + "copyfile"; + "copyobj"; + "copyoptionsfcn"; + "corrcoef"; + "cosd"; + "cotd"; + "cov"; + "coveragerpt"; + "cplxdemo"; + "cplxgrid"; + "cplxmap"; + "cplxpair"; + "cplxroot"; + "createClassFromWsdl"; + "createSoapMessage"; + "cross"; + "cruller"; + "cscd"; + "cshelp"; + "csvread"; + "csvwrite"; + "ctlpanel"; + "ctranspose"; + "cumtrapz"; + "curl"; + "customverctrl"; + "cvs"; + "cylinder"; + "daqread"; + "daspect"; + "datachildren"; + "datacursormode"; + "dataread"; + "datatipinfo"; + "datenum"; + "datestr"; + "datetick"; + "datevec"; + "dbclear"; + "dbcont"; + "dbdown"; + "dblquad"; + "dbmex"; + "dbquit"; + "dbstack"; + "dbstatus"; + "dbstep"; + "dbstop"; + "dbtype"; + "dbup"; + "dde23"; + "ddeget"; + "ddeset"; + "ddex1"; + "ddex1de"; + "ddex1hist"; + "ddex2"; + "deal"; + "deblank"; + "debug"; + "dec2base"; + "dec2bin"; + "decic"; + "deconv"; + "del2"; + "delaunay"; + "delaunay3"; + "delaunayn"; + "deleteconfirm"; + "delsq"; + "delsqdemo"; + "demo"; + "demos"; + "demowin"; + "depdir"; + "depfun"; + "deprpt"; + "deselectall"; + "desktop"; + "desktopmenufcn"; + "detrend"; + "deval"; + "dialog"; + "diff2asv"; + "diffcode"; + "diffrpt"; + "diffuse"; + "divergence"; + "dlmread"; + "dlmwrite"; + "dmperm"; + "doclick"; + "docroot"; + "docsearch"; + "dofixrpt"; + "dokeypress"; + "domymenu"; + "doresize"; + "dot"; + "dragrect"; + "dsearch"; + "dsearchn"; + "e2pi"; + "e_handler"; + "earthmap"; + "edit"; + "editmenufcn"; + "editpath"; + "edtext"; + "eigmovie"; + "eigs"; + "eigs2"; + "eigshow"; + "ellipj"; + "ellipke"; + "ellipsoid"; + "emdenbvp"; + "enddrag"; + "eomday"; + "eq"; + "erfcinv"; + "erfcore"; + "erfinv"; + "errorbar"; + "errordlg"; + "etree"; + "etreeplot"; + "evalc"; + "evalin"; + "evalmcw"; + "expint"; + "expm1"; + "expmdemo"; + "expmdemo1"; + "expmdemo2"; + "expmdemo3"; + "export2wsdlg"; + "exportsetupdlg"; + "extent"; + "ezcontour"; + "ezcontourf"; + "ezgraph3"; + "ezmesh"; + "ezmeshc"; + "ezplot"; + "ezplot3"; + "ezpolar"; + "ezsurf"; + "ezsurfc"; + "factor"; + "factorial"; + "fcnchk"; + "feather"; + "fem1ode"; + "fem2ode"; + "fft2"; + "fftdemo"; + "fftn"; + "fftw"; + "fibodemo"; + "fieldnames"; + "fifteen"; + "figcopytemplatelistener"; + "figflag"; + "fignamer"; + "figtoolset"; + "figure"; + "figuredeletedlistener"; + "figureheaderdlg"; + "figurepalette"; + "fileattrib"; + "filebrowser"; + "fileformats"; + "filemarker"; + "filemenufcn"; + "fileread"; + "fill"; + "fill3"; + "filter"; + "filter2"; + "findall"; + "finddemo"; + "findfigs"; + "findobj"; + "finfo"; + "fitdemo"; + "fitfun"; + "fitsinfo"; + "fitsread"; + "fixcontents"; + "fixhelp"; + "fixquote"; + "flag"; + "flipdim"; + "flops"; + "flow"; + "fminbnd"; + "fminsearch"; + "fplot"; + "frame2im"; + "freeserial"; + "freqspace"; + "fsbvp"; + "func2str"; + "function_handle"; + "functions"; + "funfuns"; + "funm"; + "fzero"; + "gallery"; + "gammainc"; + "gca"; + "gcbf"; + "gcbo"; + "gcd"; + "gcf"; + "gco"; + "ge"; + "genpath"; + "genvarname"; + "get"; + "getFigureToolManager"; + "getappdata"; + "getcallinfo"; + "getcolumn"; + "getfield"; + "getframe"; + "getobj"; + "getorcreateobj"; + "getpixelposition"; + "getplottool"; + "getpref"; + "getprinttemplate"; + "getptr"; + "getscribecontextmenu"; + "getscribeobjectdata"; + "getselectobjects"; + "getstatus"; + "getuprop"; + "ginput"; + "gmres"; + "gplot"; + "grabcode"; + "gradient"; + "graf2d"; + "graf2d2"; + "graf3d"; + "graph2dhelper"; + "gray"; + "griddata"; + "griddata3"; + "griddatan"; + "gsvd"; + "gt"; + "gtext"; + "gui_mainfcn"; + "guidata"; + "guide"; + "guidefunc"; + "guidemfile"; + "guideopts"; + "guidetemplate"; + "guidetemplate0"; + "guidetemplate1"; + "guidetemplate2"; + "guidetemplate3"; + "guihandles"; + "hadamard"; + "handle2struct"; + "hardcopy"; + "hasbehavior"; + "hb1dae"; + "hb1ode"; + "hdf"; + "hdf5info"; + "hdf5read"; + "hdf5write"; + "hdfan"; + "hdfdf24"; + "hdfdfr8"; + "hdfgd"; + "hdfh"; + "hdfhd"; + "hdfhe"; + "hdfhx"; + "hdfinfo"; + "hdfml"; + "hdfpt"; + "hdfread"; + "hdfsd"; + "hdfsw"; + "hdftool"; + "hdftoolswitchyard"; + "hdfv"; + "hdfvf"; + "hdfvh"; + "hdfvs"; + "helpdlg"; + "helpinfo"; + "helpmenufcn"; + "helprpt"; + "helpview"; + "hex2dec"; + "hex2num"; + "hgaddbehavior"; + "hgbehaviorfactory"; + "hgconvertunits"; + "hgexport"; + "hgfeval"; + "hggetbehavior"; + "hgline2lineseries"; + "hgload"; + "hgsave"; + "hgtransform"; + "hidden"; + "hidegui"; + "hilb"; + "hist"; + "histc"; + "hndlaxis"; + "hndlgraf"; + "hot"; + "hsv"; + "hsv2rgb"; + "hthelp"; + "htpp"; + "humps"; + "iburgersode"; + "icondisp"; + "ifft2"; + "ifftn"; + "ihb1dae"; + "im2frame"; + "im2java"; + "image"; + "imagedemo"; + "imageext"; + "imagesc"; + "imageview"; + "imfinfo"; + "imformats"; + "import"; + "importdata"; + "imread"; + "imtext"; + "imwrite"; + "ind2rgb"; + "ind2sub"; + "indexhelper"; + "inferiorto"; + "info"; + "initdesktoputils"; + "inlineeval"; + "inmem"; + "inpolygon"; + "inputdlg"; + "inputname"; + "insertmenufcn"; + "inside"; + "inspect"; + "instrcb"; + "instrfind"; + "instrfindall"; + "int2str"; + "int64"; + "integerMath"; + "interp1q"; + "interp2"; + "interp3"; + "interpft"; + "interpn"; + "interpstreamspeed"; + "intersect"; + "intmax"; + "intmin"; + "intro"; + "intwarning"; + "invalidateaxis"; + "inverter"; + "invhilb"; + "ipermute"; + "is2D"; + "isappdata"; + "iscellstr"; + "isdeployed"; + "isequalwithequalnans"; + "isfloat"; + "ishghandle"; + "isjava"; + "iskeyword"; + "ismethod"; + "isobject"; + "isocaps"; + "isocolors"; + "isonormals"; + "isosurface"; + "ispref"; + "isprime"; + "isprop"; + "ispuma"; + "issorted"; + "issourcecontrolconfigured"; + "isstrprop"; + "isstudent"; + "isvarname"; + "java"; + "javaAddLsnrsToFigure"; + "javaArray"; + "javaGetHandles"; + "javaMethod"; + "javaObject"; + "javaaddpath"; + "javachk"; + "javaclasspath"; + "javacomponent"; + "javafigurequeue"; + "javarmpath"; + "jet"; + "jpropeditutils"; + "klein1"; + "knot"; + "lasterr"; + "lasterror"; + "lastwarn"; + "layout"; + "lcm"; + "ldivide"; + "le"; + "legend"; + "legendcolorbarlayout"; + "legendinfo"; + "legendre"; + "libfunctions"; + "libfunctionsview"; + "libisloaded"; + "libpointer"; + "libstruct"; + "life"; + "light"; + "lightangle"; + "lighting"; + "lin2mu"; + "line"; + "lines"; + "lineseries"; + "linkaxes"; + "linkprop"; + "linsolve"; + "listdlg"; + "listfonts"; + "lists"; + "loadhtml"; + "loadlibrary"; + "loadobj"; + "log1p"; + "loglog"; + "logm"; + "logo"; + "logspace"; + "lorenz"; + "lotka"; + "lotkademo"; + "ls"; + "lscan"; + "lscov"; + "lsqnonneg"; + "lsqr"; + "lt"; + "ltitr"; + "luinc"; + "m2struct"; + "magic"; + "makebars"; + "makecontentsfile"; + "makecounter"; + "makedisplaynames"; + "makefcn"; + "makehgtform"; + "makemcode"; + "makemenu"; + "makeshow"; + "makevase"; + "mat2cell"; + "mat2str"; + "mat4bvp"; + "material"; + "matfinfo"; + "matlabpath"; + "matlabroot"; + "matmanip"; + "matq2ws"; + "matqdlg"; + "matqparse"; + "matqueue"; + "mdbfileonpath"; + "mdbpublish"; + "mdbstatus"; + "mean"; + "median"; + "membrane"; + "memory"; + "menu"; + "menubar"; + "menuedit"; + "menueditfunc"; + "menulabel"; + "mesh"; + "meshc"; + "meshgrid"; + "meshz"; + "methods"; + "methodsview"; + "mex"; + "mexdebug"; + "mexext"; + "mfilename"; + "mfiletemplate"; + "middrag"; + "mimofr"; + "minres"; + "minus"; + "mislocked"; + "mkpp"; + "mlcomiface"; + "mldivide"; + "mlint"; + "mlintrpt"; + "mlock"; + "mmcompinfo"; + "mmfileinfo"; + "modes"; + "moveaxis"; + "movefile"; + "movegui"; + "movie"; + "movie2avi"; + "moviein"; + "movieview"; + "mpoles"; + "mpower"; + "mrdivide"; + "msgbox"; + "mtimes"; + "mu2lin"; + "multibandread"; + "multibandwrite"; + "munlock"; + "namelengthmax"; + "namelengthmax"; + "nargchk"; + "nargoutchk"; + "native2unicode"; + "nchoosek"; + "nddemo"; + "ndgrid"; + "ne"; + "nestdiss"; + "nested"; + "nesteddemo"; + "newfun"; + "newplot"; + "nextpow2"; + "nnload"; + "nnz"; + "noanimate"; + "nodither"; + "nonzeros"; + "normest"; + "normest1"; + "not"; + "notebook"; + "notebookCaptureFigures"; + "notebookCompareFigures"; + "now"; + "nthroot"; + "null"; + "num2cell"; + "num2hex"; + "numel"; + "numgrid"; + "numjac"; + "nzmax"; + "objbounds"; + "ode113"; + "ode15i"; + "ode15s"; + "ode23"; + "ode23s"; + "ode23t"; + "ode23tb"; + "ode45"; + "odedemo"; + "odeexamples"; + "odefile"; + "odeget"; + "odephas2"; + "odephas3"; + "odeplot"; + "odeprint"; + "odeset"; + "odextend"; + "open"; + "openfig"; + "opengl"; + "opentoline"; + "openvar"; + "optimget"; + "optimset"; + "or"; + "orbitode"; + "orderfields"; + "ordqz"; + "ordschur"; + "orient"; + "orth"; + "overobj"; + "pack"; + "padecoef"; + "pagedlg"; + "pagesetupdlg"; + "pan"; + "paren"; + "pareto"; + "parseSoapResponse"; + "parseparams"; + "partialpath"; + "pascal"; + "patch"; + "path"; + "path2rc"; + "pathsep"; + "pathtool"; + "pbaspect"; + "pcg"; + "pchip"; + "pcode"; + "pcolor"; + "pde"; + "pdepe"; + "pdeval"; + "pdex1"; + "pdex1bc"; + "pdex1ic"; + "pdex1pde"; + "pdex2"; + "pdex3"; + "pdex4"; + "pdex5"; + "peaks"; + "penny"; + "perl"; + "perms"; + "permute"; + "persistent"; + "pie"; + "pie3"; + "pink"; + "pinv"; + "planerot"; + "playbackdemo"; + "playshow"; + "plot3"; + "plotbrowser"; + "plotchild"; + "plotdoneevent"; + "plotedit"; + "plotmatrix"; + "plottoolfunc"; + "plottools"; + "plotutils"; + "plotyy"; + "plus"; + "pol2cart"; + "polar"; + "poly"; + "polyarea"; + "polyder"; + "polyeig"; + "polyfit"; + "polyint"; + "polyval"; + "polyvalm"; + "popupstr"; + "power"; + "ppval"; + "precedence"; + "prefdir"; + "preferences"; + "prefspanel"; + "prepdrag"; + "prepender"; + "primes"; + "print"; + "printdlg"; + "printdmfile"; + "printjob"; + "printprepare"; + "printpreview"; + "printrestore"; + "printtables"; + "printtemplate"; + "prism"; + "profile"; + "profreport"; + "profsave"; + "profview"; + "profviewgateway"; + "propedit"; + "propertyeditor"; + "psi"; + "publish"; + "punct"; + "putdowntext"; + "pvcs"; + "pwch"; + "pwd"; + "qhull"; + "qhulldemo"; + "qmr"; + "qrdelete"; + "qrinsert"; + "qrupdate"; + "quad"; + "quad8"; + "quadl"; + "quadv"; + "quake"; + "quatdemo"; + "questdlg"; + "quivdemo"; + "quiver"; + "quiver3"; + "qz"; + "randperm"; + "rank"; + "rat"; + "rats"; + "rbbox"; + "rcs"; + "rdivide"; + "reallog"; + "realpow"; + "realsqrt"; + "rectangle"; + "rectint"; + "recycle"; + "reducepatch"; + "reducevolume"; + "refresh"; + "refreshdata"; + "regexp"; + "regexpi"; + "regexprep"; + "rehash"; + "reloadsys"; + "relop"; + "remapfig"; + "render_basicaudiotoolbar"; + "render_fullaudiotoolbar"; + "reset"; + "resetplotview"; + "resi2"; + "residue"; + "rethrow"; + "rgb2hsv"; + "rgbplot"; + "ribbon"; + "rigidode"; + "rjr"; + "rmappdata"; + "rmdir"; + "rmfield"; + "rmpath"; + "rmpref"; + "roots"; + "rose"; + "rosser"; + "rot90"; + "rotate"; + "rotate3d"; + "rref"; + "rrefmovie"; + "rsf2csf"; + "run"; + "runreport"; + "saveas"; + "saveobj"; + "savepath"; + "savtoner"; + "scatter"; + "scatter3"; + "scribealign"; + "scribeaxesdlg"; + "scribeclearmode"; + "scribecursors"; + "scribeeventhandler"; + "scribefiglisten"; + "scribelinedlg"; + "scriberestoresavefcns"; + "scribetextdlg"; + "script"; + "sec"; + "secd"; + "sech"; + "selectmoveresize"; + "selectobject"; + "semilogx"; + "semilogy"; + "sendmail"; + "sepplot"; + "set"; + "setappdata"; + "setdiff"; + "setfield"; + "setpixelposition"; + "setpref"; + "setptr"; + "setscribecontextmenu"; + "setscribeobjectdata"; + "setstatus"; + "setuprop"; + "setxor"; + "shading"; + "shg"; + "shiftdim"; + "shockbvp"; + "showplottool"; + "shrinkfaces"; + "sind"; + "single"; + "singleMath"; + "slash"; + "slice"; + "slide2script"; + "smooth3"; + "snapshot"; + "snaptogrid"; + "soma"; + "somasols"; + "sortrows"; + "sound"; + "soundsc"; + "soundview"; + "sourcesafe"; + "spalloc"; + "sparsfun"; + "sparsity"; + "spaugment"; + "spconvert"; + "spdiags"; + "specular"; + "speye"; + "spfun"; + "sph2cart"; + "spharm2"; + "sphere"; + "spinmap"; + "spiral"; + "spline"; + "spline2d"; + "splncore"; + "spones"; + "spparms"; + "sprand"; + "sprandn"; + "sprandsym"; + "sprank"; + "spring"; + "sprintf"; + "spy"; + "spypart"; + "sqrtm"; + "squeeze"; + "ss2tf"; + "ss2zp"; + "sscanf"; + "ssdisp"; + "sshow"; + "ssinit"; + "sspause"; + "stairs"; + "standardrpt"; + "startscribeobject"; + "startscribepinning"; + "std"; + "stem"; + "stem3"; + "str2double"; + "str2func"; + "str2mat"; + "str2num"; + "str2rng"; + "strcat"; + "stream2"; + "stream3"; + "streamline"; + "streamparticles"; + "streamribbon"; + "streamslice"; + "streamtube"; + "strings"; + "stripanchors"; + "strjust"; + "strmatch"; + "strncmp"; + "strncmpi"; + "strread"; + "strtok"; + "strtrim"; + "strucdem"; + "strucdem_helper"; + "struct2cell"; + "struct2handle"; + "strvcat"; + "sub2ind"; + "subplot"; + "subsasgn"; + "subsindex"; + "subspace"; + "subsref"; + "substruct"; + "subvolume"; + "summer"; + "sunspots"; + "superiorfloat"; + "superiorto"; + "superquad"; + "support"; + "surf"; + "surf2patch"; + "surface"; + "surfc"; + "surfl"; + "surfnorm"; + "svds"; + "symamd"; + "symbfact"; + "symmlq"; + "symmmd"; + "symrcm"; + "symvar"; + "syntax"; + "system"; + "tabdlg"; + "table1"; + "table2"; + "tand"; + "taxDemo"; + "teapotdemo"; + "tempdir"; + "tempname"; + "tetramesh"; + "tex"; + "texlabel"; + "text"; + "textread"; + "textscan"; + "textscanDemo"; + "textwrap"; + "tf2ss"; + "tf2zp"; + "tfchk"; + "threebvp"; + "timerfind"; + "timerfindall"; + "times"; + "title"; + "toolsmenufcn"; + "tori4"; + "trace"; + "transpdemo"; + "transpose"; + "trapz"; + "travel"; + "treelayout"; + "treeplot"; + "trimesh"; + "triplequad"; + "triplot"; + "trisurf"; + "truss"; + "try"; + "tsearch"; + "tsearchn"; + "tube"; + "twobc"; + "twobvp"; + "twoode"; + "tzero"; + "uibuttongroup"; + "uiclearmode"; + "uicontainer"; + "uicontextmenu"; + "uicontrol"; + "uigetfile"; + "uigetpref"; + "uigettool"; + "uigettoolbar"; + "uiimport"; + "uiload"; + "uimenu"; + "uint64"; + "uiopen"; + "uipanel"; + "uipushtool"; + "uiputfile"; + "uirestore"; + "uiresume"; + "uisave"; + "uisetcolor"; + "uisetfont"; + "uisetpref"; + "uistack"; + "uisuspend"; + "uitable"; + "uitoggletool"; + "uitoolbar"; + "uitoolfactory"; + "uitree"; + "uitreefigure"; + "uitreenode"; + "uiundo"; + "uiwait"; + "umfpack"; + "uminus"; + "umtoggle"; + "undocheckout"; + "unicode2native"; + "union"; + "unique"; + "unloadlibrary"; + "unmesh"; + "unmkpp"; + "unwrap"; + "unzip"; + "uplus"; + "urlread"; + "urlwrite"; + "usejava"; + "usev6plotapi"; + "vander"; + "vanderpoldemo"; + "var"; + "vdp1"; + "vdp1000"; + "vdpode"; + "vectorize"; + "ver"; + "vertexpicker"; + "vga"; + "vibes"; + "view"; + "viewmenufcn"; + "viewmtx"; + "visdiff"; + "visdir"; + "visdirformhandler"; + "visdirrefresh"; + "vissuite"; + "volumebounds"; + "volvec"; + "voronoi"; + "voronoin"; + "vrml"; + "waitbar"; + "waitfor"; + "warndlg"; + "watchoff"; + "watchon"; + "waterfall"; + "wavfinfo"; + "wavplay"; + "wavread"; + "wavrecord"; + "wavwrite"; + "web"; + "webmenufcn"; + "weekday"; + "weissinger"; + "wernerboy"; + "what"; + "whatsnew"; + "which"; + "white"; + "whitebg"; + "why"; + "wilkinson"; + "winmenu"; + "winter"; + "wizard"; + "wk1const"; + "wk1finfo"; + "wk1read"; + "wk1wrec"; + "wk1write"; + "workspace"; + "workspacefunc"; + "wrldtrv"; + "ws2matq"; + "xfourier"; + "xgetselection"; + "xlabel"; + "xlim"; + "xlsfinfo"; + "xlsread"; + "xlswrite"; + "xmlread"; + "xmlwrite"; + "xor"; + "xpbombs"; + "xpklein"; + "xppage"; + "xpquad"; + "xpsound"; + "xpsubplt"; + "xptext"; + "xsetselection"; + "xslt"; + "xychk"; + "xycrull"; + "xyklein"; + "xyzchk"; + "xyzvchk"; + "ylabel"; + "ylim"; + "zip"; + "zlabel"; + "zlim"; + "zoom"; + "zp2ss"; + "zp2tf"] +endfunction diff --git a/modules/m2sci/macros/kernel/old2newinstr.bin b/modules/m2sci/macros/kernel/old2newinstr.bin Binary files differnew file mode 100755 index 000000000..0190897f1 --- /dev/null +++ b/modules/m2sci/macros/kernel/old2newinstr.bin diff --git a/modules/m2sci/macros/kernel/old2newinstr.sci b/modules/m2sci/macros/kernel/old2newinstr.sci new file mode 100755 index 000000000..a425bc5db --- /dev/null +++ b/modules/m2sci/macros/kernel/old2newinstr.sci @@ -0,0 +1,94 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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 instr=old2newinstr(instr,oldname,newname) + // This function replaces by a new name (given in a input argument:newname) in a Scilab instruction all the variables names and functions names matching to a given name in a input argument:oldname + // INPUTS: + // -instr: Scilab instruction + // -oldname: a string, matching to the name variable which must be replaced + // -newname: a string, matching to the new variable name + // OUTPUT: + // -instr: Scilab instruction after modification + + // VARIABLE tlist // + // If the variable name matches to the oldname argument then replace the variable name by the newname argument + if typeof(instr)=="variable" then + if instr.name==oldname then + instr.name=newname + end + // FUNCALL tlist // + // If the function name matches to oldname argument then replace the function name by newname argument + elseif typeof(instr)=="funcall" + if instr.name==oldname then + instr.name=newname + end + // ex: function return has not rhs: return.rhs is not a list + if typeof(instr.rhs)=="list" then + for i=1:size(instr.rhs) + instr.rhs(i)=old2newinstr(instr.rhs(i),oldname,newname) + end + end + // OPERATION tlist// + elseif typeof(instr)=="operation" then + for i=1:size(instr.operands) + instr.operands(i)=old2newinstr(instr.operands(i),oldname,newname) + end + // IF-THEN-ELSE instruction // + elseif typeof(instr)=="ifthenelse" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.then) + instr.then(i)=old2newinstr(instr.then(i),oldname,newname) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + instr.elseifs(i).then(k)=old2newinstr((instr.elseifs(i).then(k)),oldname,newname) + end + end + for i=1:size(instr.else) + instr.else(i)=old2newinstr((instr.else(i)),oldname,newname) + end + // SELECT-CASE instruction // + elseif typeof(instr)=="selectcase" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.cases) + for j=1:size(instr.cases(i).then) + instr.cases(i).then(j)=old2newinstr((instr.cases(i).then(j)),oldname,newname) + end + end + for i=1:size(instr.else) + instr.else(i)=old2newinstr(instr.else(i),oldname,newname) + end + // WHILE instruction // + elseif typeof(instr)=="while" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.statements) + instr.statements(i)=old2newinstr(instr.statements(i),oldname,newname) + end + // TRY-CATCH instruction // + elseif typeof(instr)=="trycatch" + for i=1:size(instr.trystat) + instr.trystat(i)=old2newinstr(instr.trystat(i),oldname,newname) + end + for i=1:size(instr.catchstat) + instr.catchstat(i)=old2newinstr(instr.catchstat(i),oldname,newname) + end + // FOR instruction // + elseif typeof(instr)=="for" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.statements) + instr.statements(i)=old2newinstr(instr.statements(i),oldname,newname) + end + // EQUAL instruction // + elseif typeof(instr)=="equal" then + instr.expression=old2newinstr(instr.expression,oldname,newname) + for i=1:size(instr.lhs) + instr.lhs(i)=old2newinstr(instr.lhs(i),oldname,newname) + end + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/operation2sci.bin b/modules/m2sci/macros/kernel/operation2sci.bin Binary files differnew file mode 100755 index 000000000..9d6972a29 --- /dev/null +++ b/modules/m2sci/macros/kernel/operation2sci.bin diff --git a/modules/m2sci/macros/kernel/operation2sci.sci b/modules/m2sci/macros/kernel/operation2sci.sci new file mode 100755 index 000000000..7705c4300 --- /dev/null +++ b/modules/m2sci/macros/kernel/operation2sci.sci @@ -0,0 +1,72 @@ +// 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 [sci_equiv]=operation2sci(mtlb_expr) + // M2SCI function + // Convert a function call in an instruction or in an expression from Matlab to Scilab + // Input: + // - mtlb_instr: Matlab instr or expression to convert + // Output: + // - sci_instr: Scilab equivalent for mtlb_instr + + sci_equiv=mtlb_expr + + nboperands=size(mtlb_expr.operands) + + // Special case for extraction + if mtlb_expr.operator=="ext" then + [bval,index]=isdefinedvar(mtlb_expr.operands(1)) + + // Variable is unknown + if ~bval then + // Try to find what is this variable + [tmp]=getvar2sci(mtlb_expr.operands(1),lhslist) + if typeof(tmp)=="funcall" then + newname=mtlb_expr.operands(1).name + mtlb_expr.operands(1)=null() + mtlb_expr=Funcall(newname,size(lhslist),mtlb_expr.operands,lhslist) + [sci_equiv]=expression2sci(mtlb_expr,lhslist) + return + else + end + end + end + + opind=1 + while opind<=nboperands + [sci_operand]=expression2sci(mtlb_expr.operands(opind)) + mtlb_expr.operands(opind)=sci_operand + opind=opind+1 + // Special case for insertion, is this case, last operand (right expression) is not converted + if mtlb_expr.operator=="ins" & opind==nboperands then + break + end + + end + + // Function find is not used because does not work with strings + ind=-1 + for kop=1:size(ops,1) + if ops(kop,1)==mtlb_expr.operator then + ind=kop + break + end + end + if ind==-1 then + error(msprintf(gettext("operator %s not found."),mtlb_expr.operator)) + end + rhs=size(mtlb_expr.operands) + execstr("[sci_equiv]=%"+ops(ind,2)+"2sci(mtlb_expr)"); + + // Update lhsnb if Scilab equivalent is a function call + if typeof(sci_equiv)=="funcall" then + sci_equiv.lhsnb=size(sci_equiv.lhs) + end + +endfunction diff --git a/modules/m2sci/macros/kernel/repl_poss.bin b/modules/m2sci/macros/kernel/repl_poss.bin Binary files differnew file mode 100755 index 000000000..9c67a3373 --- /dev/null +++ b/modules/m2sci/macros/kernel/repl_poss.bin diff --git a/modules/m2sci/macros/kernel/repl_poss.sci b/modules/m2sci/macros/kernel/repl_poss.sci new file mode 100755 index 000000000..d7d8e2807 --- /dev/null +++ b/modules/m2sci/macros/kernel/repl_poss.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 []=repl_poss(expr,varargin) + // Display information for replacement for a statement in converted file + + txt=[] + nposs=size(varargin) + + if nposs==0 | fix(nposs/3)*3~=nposs then + error(gettext("Wrong number of inputs.")) + end + + txt=[expression2code(expr)+gettext(" may be replaced by:")] + for k=1:3:nposs + vars="" + if typeof(varargin(k+1))<>"list" then + vars=expression2code(varargin(k+1)) + else + for l=1:size(varargin(k+1)) + vars=vars+expression2code(varargin(k+1)(l)) + if l<size(varargin(k+1)) then + vars=vars+" and " + end + end + end + txt=[ + txt + " --> "+expression2code(varargin(k))+" "+gettext("if")+" "+vars+" "+varargin(k+2)] + end + + set_infos(txt,1) + +endfunction diff --git a/modules/m2sci/macros/kernel/replace_brackets.bin b/modules/m2sci/macros/kernel/replace_brackets.bin Binary files differnew file mode 100755 index 000000000..b83f831f0 --- /dev/null +++ b/modules/m2sci/macros/kernel/replace_brackets.bin diff --git a/modules/m2sci/macros/kernel/replace_brackets.sci b/modules/m2sci/macros/kernel/replace_brackets.sci new file mode 100755 index 000000000..084923e06 --- /dev/null +++ b/modules/m2sci/macros/kernel/replace_brackets.sci @@ -0,0 +1,52 @@ +// 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 txt=replace_brackets(txt) + + symbs=[",",";","=",")","]","("] + // This file will be use to deal with cells... + for k=1:size(txt,"r") + + // select-case + if strindex(txt(k),"case")<>[] then + txt(k)=strsubst(strsubst(txt(k),"{","makecell("),"}",")") + else + tk=strsubst(txt(k)," ","") + + ko=strindex(tk,"{") + if ko<>[] then + teq=strindex(tk,"=") + + /// + if ko(1)==1 then + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + elseif or(part(tk,ko(1)-1)==symbs) then + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + else // Cell index + txt(k)=strsubst(strsubst(txt(k),"{","("),"}",").entries") + end + + //// + + for kk=2:size(ko,"*") + if or(part(tk,ko(kk)-1)==symbs) then // Cell creation + txt(k)=strsubst(txt(k),"{}","makecell()") + txt(k)=strsubst(strsubst(txt(k),"{","(makecell([cell(),"),"}","]))") + else // Cell index + txt(k)=strsubst(strsubst(txt(k),"{","("),"}",").entries") + end + end + elseif ~isempty(strindex(txt(k),"}")) then + txt(k)=strsubst(txt(k),"}","]))") + end + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/sci_generic.bin b/modules/m2sci/macros/kernel/sci_generic.bin Binary files differnew file mode 100755 index 000000000..cca08126d --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_generic.bin diff --git a/modules/m2sci/macros/kernel/sci_generic.sci b/modules/m2sci/macros/kernel/sci_generic.sci new file mode 100755 index 000000000..ffe4d8307 --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_generic.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]=sci_generic(tree) + // M2SCI function + // Generic conversion function for unknown Matlab functions + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if typeof(tree)=="operation" + tree.out(1).dims=list(-1,-1) + tree.out(1).type=Type(-1,-1) + else + for i=1:size(tree.lhs) + tree.lhs(i).dims=list(-1,-1) + tree.lhs(i).type=Type(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/kernel/sci_m2scideclare.bin b/modules/m2sci/macros/kernel/sci_m2scideclare.bin Binary files differnew file mode 100755 index 000000000..a6849403e --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_m2scideclare.bin diff --git a/modules/m2sci/macros/kernel/sci_m2scideclare.sci b/modules/m2sci/macros/kernel/sci_m2scideclare.sci new file mode 100755 index 000000000..c1c41bcc0 --- /dev/null +++ b/modules/m2sci/macros/kernel/sci_m2scideclare.sci @@ -0,0 +1,342 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - 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 []=sci_m2scideclare(def) + // This function translate calls to m2scideclare + // which can be used by the user to influence translation + // by adding a comment which begins by m2scideclare + + // Global variable for M2SCI + global("varslist") + + //variable_name|dimensions|datatype|property + + //dimensions: variable dimensions separated by blanks (Unknown dimension is ?) + + //datatype: + // - double: scalar/vector/matrix/hypermatrix containing double values + // - string: scalar/vector/matrix/hypermatrix containing character strings + // - boolean: scalar/vector/matrix/hypermatrix containing boolean values + // - int: scalar/vector/matrix/hypermatrix containing integer values + // - handle: matrix of graphics handles or graphics handle + // - sparse: sparse scalar/vector/matrix/hypermatrix + // - cell: cell array + // - struct: struct array + // - ? if unknown + + //property: + // - real/complex/? for double and int datatype + // - real for string and boolean datatype (ignored if not) + // - NOT USED for struct/cell/handle datatype + + // def is the comment added by the user + userdata=def.rhs(1).value + // Remove all multiple blanks + while strindex(userdata," ")<>[] + userdata=strsubst(userdat," "," ") + end + + seppos=strindex(userdata,"|") + + seppos=[seppos,length(userdata)+1] + + nbsep=size(seppos,"*") + + if nbsep<3 then + error(gettext("not enough data, you should give at least variable_name|dimensions|datatype.")); + elseif nbsep>4 then + error(gettext("too much data.")); + end + + name=stripblanks(part(userdata,1:seppos(1)-1)) + + dimstxt=part(userdata,seppos(1)+1:seppos(2)-1) + + datatypetxt=part(userdata,seppos(2)+1:seppos(3)-1) + + if nbsep==4 then + proptxt=part(userdata,seppos(3)+1:seppos(4)-1) + else + proptxt="?" + end + + // Dimensions + dimstxt=strsubst(dimstxt,"?","-1") + dimstxt=strsubst(dimstxt,"*","-2") + dimstxt=strsubst(dimstxt,"#","-3") + blpos=strindex(dimstxt," ") + nbblanks=size(blpos) + blpos=[1,blpos,length(dimstxt)+1] + fmt="%d" + dims=list() + for kbl=1:size(blpos,"*")-1 + dims($+1)=evstr(part(dimstxt,blpos(kbl):blpos(kbl+1))) + end + + // Datatype + datatypetxt=strsubst(datatypetxt,"?","Unknown") + datatype=convstr(datatypetxt,"l") + if or(datatype==["double","boolean","string","int","handle","sparse","cell","struct","unknown"]) then + datatype=convstr(part(datatype,1),"u")+convstr(part(datatype,2:length(datatype)),"l") + vtype=evstr(datatype) + else + error(msprintf(gettext("Unknown datatype %s."),datatypetxt)); + end + + // Property + proptxt=strsubst(proptxt,"?","Unknown") + prop=convstr(proptxt,"l") + if or(prop==["real","complex","homogen","unknown"]) then + prop=convstr(part(prop,1),"u")+part(prop,2:length(prop)) + property=evstr(prop) + else + error(msprintf(gettext("Unknown property %s."),proptxt)); + end + // Property correction + if or(vtype==[Boolean,String]) then + property=Real + end + + if strindex(name,".")<>[] then // Cell or Struct m2scideclare + // Get varname + endofname=min([strindex(name,[".","("])])-1 + varname=part(name,1:endofname) + + // First field name (if is 'entries' then a cell else a struct) + firstpoint=min(strindex(name,".")) + secpoint=min(strindex(part(name,firstpoint+1:length(name)),".")) + par=min(strindex(part(name,firstpoint+1:length(name)),"(")) + if isempty(secpoint) & isempty(par) then //x.fieldname + firstfield=part(name,firstpoint:length(name)) + elseif isempty(secpoint) then //x.fieldname(p...) + firstfield=part(name,firstpoint:par-1) + elseif isempty(par) then //x.fieldname.fieldname2 + firstfield=part(name,firstpoint:secpoint-1) + else //x.fieldname(p...).fieldname2 + firstfield=part(name,firstpoint:min([secpoint par])-1) + end + if firstfield==".entries" then // Cell + vartype=Cell + else // Struct + vartype=Struct + end + + // Indexes for varname ? myvar(1,2).field.... + if or(strindex(name,"(")<strindex(name,".")) | (~isempty(strindex(name,"("))&isempty(strindex(name,"."))) then + ierr=execstr("vardims=list"+part(name,min(strindex(name,"(")):min(strindex(name,")"))),"errcatch") + if ierr then + if ~isempty(strindex(part(name,min(strindex(name,"(")):min(strindex(name,")"))),"*")) then // Generic command * + vardims="generic" + else + error(gettext("Wrong dimensions user data.")); + end + end + else + vardims=list(1,1) + end + + [isvar,index]=isdefinedvar(Variable(varname,Infer())) + + if ~isvar then // If variable does not exist it is added to varslist + if vardims=="generic" then + vardims=list(Unknown,Unknown) + end + contents=Contents() + name=strsubst(name,"*","%genericm2sciindex") + deff("m2scitmp",name) + t=macr2tree(m2scitmp); + if isempty(firstpoint) then + contents.index($+1)=t.statements(2).expression.rhs; + else + contents.index($+1)=t.statements(2).expression.rhs(1); + end + clear m2scitmp + for k=1:lstsize(contents.index($)) + if typeof(contents.index($)(k))=="variable" & contents.index($)(k).name=="%genericm2sciindex" then + contents.index($)(k)=Cste("*") + elseif typeof(contents.index($)(k))=="cste" then + contents.index($)(k)=Cste(contents.index($)(k).value) + elseif typeof(contents.index($)(k))=="list" then + for kk=1:lstsize(contents.index($)(k)) + if typeof(contents.index($)(k)(kk))=="variable" & contents.index($)(k)(kk).name=="%genericm2sciindex" then + contents.index($)(k)(kk)=Cste("*") + elseif typeof(contents.index($)(k)(kk))=="cste" then + contents.index($)(k)(kk)=Cste(contents.index($)(k)(kk).value) + end + end + end + end + contents.data($+1)=Infer(dims,Type(vtype,property)) + varslist($+1)=M2scivar(varname,varname,Infer(vardims,Type(vartype,Unknown),contents)) + else + if vardims=="generic" then + vardims=varslist(index).dims + else + vardims=dims + end + + infereddims=varslist(index).dims + + err=%F + for kd=1:min([lstsize(vardims) lstsize(infereddims)]) + if infereddims(kd)~=vardims(kd) & infereddims(kd)<>Unknown then + err=%T + break + end + end + + // Update dimensions + if err then + set_infos(msprintf(gettext("Dimensions current value and m2scideclare statements conflict for: %s\n m2scideclare given dimension: %s\n Current dimension: %s\n m2scideclare IGNORED"),varname,dims2str(vardims),dims2str(infereddims)),2) + else + varslist(index)=M2scivar(varslist(index).matname,varslist(index).matname,Infer(vardims,Type(varslist(index).type.vtype,property))) + end + + // Update vtype + if varslist(index).type.vtype==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).matname,Infer(vardims,Type(vartype,varslist(index).property))) + elseif varslist(index).type.vtype~=vartype then + set_infos(msprintf(gettext("Type current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),varname,tp2str(vartype),tp2str(varslist(index).type.vtype)),2) + end + + // Update property + if varslist(index).property==Unknown then + varslist(index).infer.type.property=property + elseif property==Unknown then + varslist(index).type.property=Unknown + elseif varslist(index).type.property~=property then + set_infos(msprintf(gettext("Property current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,prop2str(Unknown),prop2str(varslist(index).type.property)),2) + end + + // Update contents (no verification made...too complex) + contents=varslist(index).contents + name=strsubst(name,"*","%genericm2sciindex") + deff("m2scitmp",name) + t=macr2tree(m2scitmp); + if isempty(firstpoint) then + contents.index($+1)=t.statements(2).expression.rhs; + else + contents.index($+1)=t.statements(2).expression.rhs(1); + end + clear m2scitmp + for k=1:lstsize(contents.index($)) + if typeof(contents.index($)(k))=="variable" & contents.index($)(k).name=="%genericm2sciindex" then + contents.index($)(k)=Cste("*") + elseif typeof(contents.index($)(k))=="cste" then + contents.index($)(k)=Cste(contents.index($)(k).value) + elseif typeof(contents.index($)(k))=="list" then + for kk=1:lstsize(contents.index($)(k)) + if typeof(contents.index($)(k)(kk))=="variable" & contents.index($)(k)(kk).name=="%genericm2sciindex" then + contents.index($)(k)(kk)=Cste("*") + elseif typeof(contents.index($)(k)(kk))=="cste" then + contents.index($)(k)(kk)=Cste(contents.index($)(k)(kk).value) + end + end + end + end + contents.data($+1)=Infer(dims,Type(vtype,property)) + varslist(index)=M2scivar(varname,varname,Infer(vardims,Type(vartype,Unknown),contents)) + + end + else // Variable m2scideclare + + // Special part for %graphicswindow + if name=="%graphicswindow" then + global %graphicswindow + if and(vtype<>[Handle,Double]) then + set_infos(gettext("%graphicswindow set to default value Handle."),2); + else + %graphicswindow=vtype + end + return + end + + [isvar,index]=isdefinedvar(Variable(name,Infer())) + + if ~isvar then // If variable does not exist it is added to varslist + varslist($+1)=M2scivar(name,name,Infer(dims,Type(vtype,property))) + else // Try to compare with already infered data + // Update dims + infereddims=varslist(index).dims + + err=%F + for kd=1:min([lstsize(dims) lstsize(infereddims)]) + if infereddims(kd)~=dims(kd) & infereddims(kd)<>Unknown then + err=%T + break + end + end + + if err then + set_infos(msprintf(gettext("Dimensions current value and m2scideclare statements conflict for: %s\n m2scideclare given dimension: %s\n Current dimension: %s\n m2scideclare IGNORED"),name,dims2str(dims),dims2str(infereddims)),2) + else + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(dims,varslist(index).type)) + end + + // Update vtype + if varslist(index).type.vtype==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(varslist(index).dims,Type(vtype,varslist(index).type.property))) + elseif varslist(index).type.vtype~=vtype then + set_infos(msprintf(gettext("Type current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,tp2str(vtype),tp2str(varslist(index).type.vtype)),2) + end + + // Update property + if varslist(index).type.property==Unknown then + varslist(index)=M2scivar(varslist(index).matname,varslist(index).sciname,Infer(varslist(index).dims,Type(varslist(index).type.vtype,property))) + elseif varslist(index).type.property~=property then + set_infos(msprintf(gettext("Property current value and m2scideclare statements conflict for: %s\n m2scideclare given type: %s\n current type: %s\n m2scideclare IGNORED"),name,prop2str(property),prop2str(varslist(index).type.property)),2) + end + end + end +endfunction + + +function str=tp2str(tp) + // Returns equivalent of typeof() from data coming from type() + + if tp==1 then + str="Double" + elseif tp==4 then + str="Boolean" + elseif tp==6 then + str="Sparse" + elseif tp==8 then + str="Int" + elseif tp==9 then + str="Handle" + elseif tp==10 then + str="String" + elseif tp==16 then + str="Struct" + elseif tp==17 then + str="Cell" + elseif tp==-1 then + str="Unknown" + else + error(msprintf(gettext("type %d is not implemented."),tp)) + end +endfunction + +function str=prop2str(prop) + if type(prop)==10 then + str=prop + elseif prop==-1 then + str="Unknown" + else + error(msprintf(gettext("type %d is not implemented."),prop)) + end +endfunction + +function str=dims2str(dims) + str="" + for kd=1:lstsize(dims) + str=str+string(dims(kd))+" " + end +endfunction diff --git a/modules/m2sci/macros/kernel/sciparam.bin b/modules/m2sci/macros/kernel/sciparam.bin Binary files differnew file mode 100755 index 000000000..e028f558c --- /dev/null +++ b/modules/m2sci/macros/kernel/sciparam.bin diff --git a/modules/m2sci/macros/kernel/sciparam.sci b/modules/m2sci/macros/kernel/sciparam.sci new file mode 100755 index 000000000..4c420376a --- /dev/null +++ b/modules/m2sci/macros/kernel/sciparam.sci @@ -0,0 +1,56 @@ +// 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 sciparam() + // M2SCI variable declaration + // All variables listed below can be accessed for reading from all macros called from m2sci() macro + + quote="''" + logics=["==","<",">","<=",">=","<>"] + + // Operations code + // [ operation symbol, operation translation function code ; ...] + // e.g. : translation function for addition (+) is named %a2sci()... + ops = [ "+" , "a" ; + "-" , "s" ; + "*" , "m" ; + ".*" , "x" ; + "*." , "u" ; + ".*." , "k" ; + "/" , "r" ; + "./" , "d" ; + "/." , "v" ; + "./." , "y" ; + "\" , "l" ; + ".\" , "q" ; + "\." , "w" ; + ".\." , "z" ; + "^" , "p" ; + "==" , "log" ; + "<" , "log" ; + ">" , "log" ; + "<=" , "log" ; + ">=" , "log" ; + "~=" , "log" ; + ":" , "imp" ; + "rc" , "rc" ; + "ins" , "i" ; + "ext" , "e" ; + quote , "t" ; + "cc" , "cc" ; + "|" , "g" ; + "&" , "h" ; + "~" , "5" ; + ".^" , "j" ; + "."+quote , "0" ; + "cceol" , "cc" ] // Column Concatenation with EOL between Rows + + [logics,ops,quote]=resume(logics,ops,quote) + +endfunction diff --git a/modules/m2sci/macros/kernel/set_infos.bin b/modules/m2sci/macros/kernel/set_infos.bin Binary files differnew file mode 100755 index 000000000..ff1c90da4 --- /dev/null +++ b/modules/m2sci/macros/kernel/set_infos.bin diff --git a/modules/m2sci/macros/kernel/set_infos.sci b/modules/m2sci/macros/kernel/set_infos.sci new file mode 100755 index 000000000..927e49414 --- /dev/null +++ b/modules/m2sci/macros/kernel/set_infos.sci @@ -0,0 +1,27 @@ +// 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 []=set_infos(t,level) + + // Add warning and error messages obtained while translating to display it in the end of file translation + global("m2sci_infos") + + t(1)="L."+string(nblines)+": "+t(1) + + select level + case 0 then + case 1 then + m2sci_infos(level)=%t + t="! "+t + case 2 then + m2sci_infos(level)=%t + t="!! "+t + end + m2sci_info(t,verbose_mode); +endfunction diff --git a/modules/m2sci/macros/kernel/transformtree.bin b/modules/m2sci/macros/kernel/transformtree.bin Binary files differnew file mode 100755 index 000000000..51744bad8 --- /dev/null +++ b/modules/m2sci/macros/kernel/transformtree.bin diff --git a/modules/m2sci/macros/kernel/transformtree.sci b/modules/m2sci/macros/kernel/transformtree.sci new file mode 100755 index 000000000..5478ebb31 --- /dev/null +++ b/modules/m2sci/macros/kernel/transformtree.sci @@ -0,0 +1,84 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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 instr=transformtree(instr) + //TRANSFORMTREE function + //This function research and transform the equal instructions(if the lhs are a multi_operation and expression is a funcall) + //of the matlab tree to a sup_equal instructions + //sup_equal is a tlist : tlist([sup_equal,sup_instr,nb_op],sup_instr,nb_op) + //i.e : the equal instruction [a(1),b(2:3)]=f() is replaced by + //sup_equal, whith sup_intr list is composed to : + //[%v1,%v2]=f() + //a(1)=%v1 + //b(2:3)=%v2 + //and nb_op is: the number of insert operation (in this case 2) + //Input + //instr : instruction of matlab tree before tranformation + //Output + //instr : instruction of matlab tree after transformation + + Unknown=-1; + // Browse all the instrucions of the matlab tree: + if typeof(instr)=="ifthenelse" then + for i=1:size(instr.then) + instr.then(i)=transformtree((instr.then(i))) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + instr.elseifs(i).then(k)=transformtree((instr.elseifs(i).then(k))) + end + end + for i=1:size(instr.else) + instr.else(i)=transformtree((instr.else(i))) + end + elseif typeof(instr)=="selectcase" then + for i=1:size(instr.cases) + for j=1:size(instr.cases(i).then) + instr.cases(i).then(j)=transformtree((instr.cases(i).then(j))) + end + end + for i=1:size(instr.else) + instr.else(i)=transformtree(instr.else(i)) + end + elseif typeof(instr)=="while" then + for i=1:size(instr.statements) + instr.statements(i)=transformtree(instr.statements(i)) + end + elseif typeof(instr)=="for" then + for i=1:size(instr.statements) + instr.statements(i)=transformtree(instr.statements(i)) + end + //instruction is an equal instruction + elseif typeof(instr)=="equal" then + if typeof(instr.expression)=="funcall" then //expression is a funcall + nb_opr=0; + for ind=1:size(instr.lhs) + if typeof(instr.lhs(ind))=="operation" then + nb_opr=nb_opr+1 + end + end + if nb_opr>1 then //more than one lhs insert operation + sup_instr=list(""); + lhstemp=list(); + for j=1:size(instr.lhs) + if typeof(instr.lhs(j))=="operation" then + x=gettempvar(); + sup_instr($+1)=Equal(list(instr.lhs(j)),x); + lhstemp(j)=x; + else + lhstemp(j)=instr.lhs(j) + end + end + sup_instr(1)=Equal(lhstemp,instr.expression) + //creation of the sup_equal + instr=tlist(["sup_equal","sup_instr","nb_opr"],sup_instr,nb_opr) + end + end + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/kernel/translateorder.bin b/modules/m2sci/macros/kernel/translateorder.bin Binary files differnew file mode 100755 index 000000000..3b1d7665f --- /dev/null +++ b/modules/m2sci/macros/kernel/translateorder.bin diff --git a/modules/m2sci/macros/kernel/translateorder.sci b/modules/m2sci/macros/kernel/translateorder.sci new file mode 100755 index 000000000..89acd5d8b --- /dev/null +++ b/modules/m2sci/macros/kernel/translateorder.sci @@ -0,0 +1,49 @@ +// 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 [transorder]=translateorder(transorder,funtxt,overfunname) + // TRANSLATEORDER Recursive function + // Determinates a translate order of the M-files found in Paths (used by "translatepaths" function) + // Output-Input + // -transorder : a vector containing the M-files names which are arranged in order to respect an priority order of translation + // Input + // -funtxt : a vector which contains the name of a M-file found in the Paths (its first component: funtxt(1)), and the called functions by this file (the others components : funtxt(2:$)) + // -overfunname : a vector which contains the files names being passed like argument of "translateorder" function + + // the file is already in the list + if or(transorder==funtxt(1)) then + return + end + + if size(funtxt,"*")>1 then + for i=2:size(funtxt,1) + // the called function is already in the list + if find(funtxt(i)==transorder)<>[] then + continue + // the called function is already passed in argument of "translateorder" function (a loop) + elseif find(funtxt(i)==overfunname)<>[] then + disp([overfunname;funtxt(i)],"loop: ") + //return + continue + // order the under level, also we call translateorder (recursive) + else + overfunname($+1)=funtxt(1) + execstr("[transorder]=translateorder(transorder,"+funtxt(i)+"vect,overfunname)") + end + end + transorder($+1)=funtxt(1) + else + // no called function by the M-file, also we put the M-file name in the transorder vector + transorder($+1)=funtxt(1) + end + +endfunction + + + diff --git a/modules/m2sci/macros/kernel/update_instr_list.bin b/modules/m2sci/macros/kernel/update_instr_list.bin Binary files differnew file mode 100755 index 000000000..4f950bce2 --- /dev/null +++ b/modules/m2sci/macros/kernel/update_instr_list.bin diff --git a/modules/m2sci/macros/kernel/update_instr_list.sci b/modules/m2sci/macros/kernel/update_instr_list.sci new file mode 100755 index 000000000..87526ae45 --- /dev/null +++ b/modules/m2sci/macros/kernel/update_instr_list.sci @@ -0,0 +1,45 @@ +// 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 [instr_list]=update_instr_list(instr_list,instr) + // M2SCI function + + // Global variables for M2SCI + global("m2sci_to_insert_b") + if isempty(m2sci_to_insert_b) + m2sci_to_insert_b = list(); + end + global("m2sci_to_insert_a") + if isempty(m2sci_to_insert_a) + m2sci_to_insert_a = list(); + end + + // Get instructions that must be inserted before converted instruction + for k=1:lstsize(m2sci_to_insert_b) + if m2sci_to_insert_b(k)<>list() then + instr_list($+1)=m2sci_to_insert_b(k) + end + end + m2sci_to_insert_b=list() + + // Insert converted instruction + // instr can be an empty list if a call to 'm2scideclare' or convertion made in m2sci_to_insert_b + if instr<>list() then + instr_list($+1)=instr + end + + // Get instructions that must be inserted after converted instruction + for k=1:lstsize(m2sci_to_insert_a) + if m2sci_to_insert_a(k)<>list() then + instr_list($+1)=m2sci_to_insert_a(k) + end + end + m2sci_to_insert_a=list() + +endfunction diff --git a/modules/m2sci/macros/kernel/updatevarslist.bin b/modules/m2sci/macros/kernel/updatevarslist.bin Binary files differnew file mode 100755 index 000000000..949389aa7 --- /dev/null +++ b/modules/m2sci/macros/kernel/updatevarslist.bin diff --git a/modules/m2sci/macros/kernel/updatevarslist.sci b/modules/m2sci/macros/kernel/updatevarslist.sci new file mode 100755 index 000000000..a19d331b3 --- /dev/null +++ b/modules/m2sci/macros/kernel/updatevarslist.sci @@ -0,0 +1,233 @@ +// 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 []=updatevarslist(instr_lhs) + // (2 functions in this file: merge_vars() at the end) + // Update list of M2SCI variables with converted instruction lhs + // Input: + // - instr_lhs: list of lhs of current instruction + // - in_a_clause: boolean value + // Set to 1 if instruction is in a clause + // In this case, type and dimensions are set to unknown if differ from those already stored in varslist + // (Default value is %F) + + // Global variable for M2SCI + global("varslist") + if isempty(varslist) + varslist = list() + end + // level is declared in m2sci.sci and modified in clause2sci.sci + level; + + rhs=argn(2) + if rhs==2 then + in_a_clause=%F + end + + // Merge infered data from the last two parts of clause which are above the current part + // if we are in the third part of clause (current), then : merge the first and second part of clause + // when end of conversion of a clause : merge infered data from the last two parts of clause + levelsize=size(level,1) + changepartclause=%F + + for i=size(varslist):-1:1 + if size(varslist(i).level,1)==levelsize then + varlevel=varslist(i).level + if varlevel($)<>level($) + changepartclause=%T + else + changepartclause=%F + break + end + end + end + if changepartclause | instr_lhs=="END OF CLAUSE" then + index=[] // Search variables from two part above current part clause + for k=size(varslist):-1:1 + if size(varslist(k).level,1)==levelsize then + varlevel=varslist(k).level + if and(varlevel(1:$-1)==level(1:$-1)) & varlevel($)==level($)-2 then + index=[index;k] + end + end + end + if index<>[] then // Found variables from the second part above current part of a clause + for k=1:size(index,1) + boolmerge =%F + for i=size(varslist):-1:1 // Search variables from the first part above current part of a clause, and which have the same name than variables from the second part above current part of a clause + varlevel=varslist(i).level + if varslist(i).matname==varslist(index(k)).matname & and(varlevel(1:$-1)==level(1:$-1)) & varlevel($)==level($)-1 then + boolmerge =%T // Found the same variable name from the last two parts above the current part : Merge + merge_vars(index(k),varslist(i)) + varslist(i)=null() + break + end + end + if ~boolmerge then + varslist(index(k)).level=[level(1:$-1);level($)-1] + end + end + end + end + + // Special case when end of conversion of a clause + // Merge infered data from clause and those from level-1 + if instr_lhs=="END OF CLAUSE" then // Search variables in the last part of a clause (above end of conversion of a clause) + index=[] // + for k=size(varslist):-1:1 // Search variables from level-1 which have the same name than variables from the last part of current level + varlevel=varslist(k).level + if varlevel==[level(1:$-1);level($)-1] then + index=[index;k] + end + end + if index<>[] then + for j=1:size(index,1) + boolmerge=%F + for k=size(varslist):-1:1 // + varlevel=varslist(k).level + if varslist(k).matname==varslist(index(j)).matname & and(varlevel==level(1:$-1)) then + boolmerge=%T // Found variables from level-1 which have the same name than variables from the last part of current level : Merge + index_lower_level=k + merge_vars(index_lower_level,varslist(index(j))) + varslist(k).level=level(1:$-1) + varslist(index(j))=null() + break + end + end + if boolmerge==%F then + varslist(index(j)).level=level(1:$-1) + end + end + end + return + end + + // Expression: lhs name is empty => nothing to do + if instr_lhs==list() then + return + end + + // Remove lhs which are not variables + k=1 + while k<=size(instr_lhs) + // Insertion operation + if typeof(instr_lhs(k))=="operation" then + instr_lhs(k)=null() + else + k=k+1 + end + end + + if size(instr_lhs)==0 then + return + end + + // Update varslist + for k=1:size(instr_lhs) + [bval,index]=isdefinedvar(instr_lhs(k)) + ierr=execstr("zz=instr_lhs(k).contents.index","errcatch") + if ierr<>0 then pause;end + // Remove multiple entries from contents + for kcont=lstsize(instr_lhs(k).contents.index):-1:1 + [infertlist,pos]=get_contents_infer(instr_lhs(k),instr_lhs(k).contents.index(kcont)) + if pos<>0 & pos<>kcont then + instr_lhs(k).contents.index(pos)=null() + instr_lhs(k).contents.data(pos)=null() + end + end + // If variable exists for the current level in the same part of clause then update exixting variable + if bval + boolupdate=%F + for l=1:size(varslist) + if varslist(l).matname==instr_lhs(k).name & varslist(l).level==level then + varslist(l)=M2scivar(varslist(l).sciname,.. + varslist(l).matname,.. + Infer(instr_lhs(k).infer.dims,instr_lhs(k).infer.type,instr_lhs(k).infer.contents),.. + varslist(l).level) + boolupdate=%T + break + end + end + // If variable exists, but not for the current level or not in the same part of clause then Update variable then create new variable + if ~boolupdate then + varslist($+1)=M2scivar(varslist(index).sciname,.. + varslist(index).matname,.. + instr_lhs(k).infer,.. + level) + end + else + // Variable added to varslist if as a name (not done for expressions + if execstr("f=instr_lhs(k).name","errcatch")<>0 then pause;end;errclear(); + if instr_lhs(k).name<>"ans" then + varslist($+1)=M2scivar(instr_lhs(k).name,.. + instr_lhs(k).name,.. + instr_lhs(k).infer,.. + level) + end + end + end +endfunction + +function []=merge_vars(oldvarindex,newvar) + // M2SCI function + // Merge two variables inference properties, if different then set to Unknown + // Input: + // - oldvarindex: index of old variable in varslist + // - newvar: new variable to take in account to update oldvar properties + + // Global variable for M2SCI + global("varslist") + oldvar=varslist(oldvarindex) + + olddims=oldvar.dims + oldvtype=oldvar.vtype + oldprop=oldvar.property + + newdims=newvar.dims + newvtype=newvar.vtype + newprop=newvar.property + + // Verify dims + for l=1:min(size(newdims),size(olddims)) + if newdims(l)<>olddims(l) then + newdims(l)=Unknown + end + end + if size(newdims)>size(olddims) then + for l=size(olddims):size(newdims) + newdims(l)=null() + end + end + + // Verify vtype + if newvtype<>oldvtype then + newvtype=Unknown + end + + // Verify property + if newprop<>oldprop then + newprop=Unknown + end + + // Verify contents + for k=1:lstsize(newvar.contents.index) + olddata=get_contents_infer(oldvar,newvar.contents.index(k)) + newdata=newvar.contents.data(k) + + if or(olddata<>newdata) then + newvar.infer.contents.data(k)=Infer() + end + end + + // Write result in varslist + varslist(oldvarindex)=M2scivar(oldvar.sciname,.. + oldvar.matname,.. + Infer(newdims,Type(newvtype,newprop),newvar.contents),.. + newvar.level) +endfunction diff --git a/modules/m2sci/macros/kernel/variablesearch.bin b/modules/m2sci/macros/kernel/variablesearch.bin Binary files differnew file mode 100755 index 000000000..55207abd5 --- /dev/null +++ b/modules/m2sci/macros/kernel/variablesearch.bin diff --git a/modules/m2sci/macros/kernel/variablesearch.sci b/modules/m2sci/macros/kernel/variablesearch.sci new file mode 100755 index 000000000..87eeba661 --- /dev/null +++ b/modules/m2sci/macros/kernel/variablesearch.sci @@ -0,0 +1,71 @@ +// 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 variablename=variablesearch(instr,variablename) + // VARIABLESEARCH recursive function (used by "translatepaths" function) + // Searches names of declared variables for each instruction of mtlbtree + // Output + // -variablename : a vector which contains the names of declared variables + // -instr : mtlbtree instruction + + // case : ifthenelse instruction + if typeof(instr) == "ifthenelse" then + for i=1:size(instr.then) + [variablename]=variablesearch((instr.then(i)),variablename) + end + for i=1:size(instr.elseifs) + for k=1:size(instr.elseifs(i).then) + [variablename]=variablesearch((instr.elseifs(i).then(k)),variablename) + end + end + for i=1:size(instr.else) + [variablename]=variablesearch((instr.else(i)),variablename) + end + // case : selectcase instruction + elseif typeof(instr) == "selectcase" then + for i=1:size(instr.cases) + [variablename]=variablesearch(instr.cases(i).expression,variablename) + for j=1:size(instr.cases(i).then) + [variablename]=variablesearch((instr.cases(i).then(j)),variablename) + end + end + for i=1:size(instr.else) + [variablename]=variablesearch(instr.else(i),variablename) + end + // case : while instruction + elseif typeof(instr) == "while" then + for i=1:size(instr.statements) + [variablename]=variablesearch(instr.statements(i),variablename) + end + // case : for instruction + elseif typeof(instr) == "for" then + [variablename]=variablesearch(instr.expression,variablename) + for i=1:size(instr.statements) + [variablename]=variablesearch(instr.statements(i),variablename) + end + // case : equal instruction + elseif typeof(instr) == "equal" then + for i=1:size(instr.lhs) + [variablename]=variablesearch(instr.lhs(i),variablename) + end + // case : operation instruction + elseif typeof(instr) == "operation" then + if instr.operator=="ins" then + if find(instr.operands(1).name==variablename)==[] then + variablename($+1)=instr.operands(1).name + end + end + // case : variable instruction + elseif typeof(instr) == "variable" then + if find(instr.name==variablename)==[] & instr.name<>"ans" then + variablename($+1)=instr.name + end + end + +endfunction diff --git a/modules/m2sci/macros/lib b/modules/m2sci/macros/lib Binary files differnew file mode 100755 index 000000000..816f48826 --- /dev/null +++ b/modules/m2sci/macros/lib diff --git a/modules/m2sci/macros/m2sci_gui.bin b/modules/m2sci/macros/m2sci_gui.bin Binary files differnew file mode 100755 index 000000000..c19a8b9f1 --- /dev/null +++ b/modules/m2sci/macros/m2sci_gui.bin diff --git a/modules/m2sci/macros/m2sci_gui.sci b/modules/m2sci/macros/m2sci_gui.sci new file mode 100755 index 000000000..4257b9d72 --- /dev/null +++ b/modules/m2sci/macros/m2sci_gui.sci @@ -0,0 +1,372 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2008 - 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 m2sci_gui() + + // Sizes + widgeth = 20; + btnh = 22; + btnw = 90; + // defaultfont = "arial"; + margin = 18; + + // Figure creation + m2scifig = figure("figure_name", gettext("Matlab to Scilab conversion tool"),... + "infobar_visible", "off",... + "toolbar_visible", "off",... + "dockable", "off",... + "menubar", "none",... + "default_axes", "off",... + "resize", "off"); + + h = uimenu("parent", m2scifig, "label", gettext("File")); + uimenu("parent", h, "label", gettext("Close"), "callback", "cb_m2sci_gui", "tag", "close_menu"); + + h = uimenu("parent", m2scifig, "label", gettext("?")); + uimenu("parent", h, "label", gettext("Mfile2sci help page"), "callback", "cb_m2sci_gui();", "tag", "mfile2sci_help_menu"); + uimenu("parent", h, "label", gettext("Translatepaths help page"), "callback", "cb_m2sci_gui();", "tag", "translatepaths_help_menu"); + uimenu("parent", h, "label", gettext("About M2SCI tools..."), "callback", "cb_m2sci_gui();", "tag", "about_m2sci_menu"); + + figw = 650; + figh = 17*margin + btnh + 7*widgeth; + m2scifig.axes_size = [figw figh]; + + //------------------- + // --- Validation --- + //------------------- + + // Convert button + convertbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Convert"),... + "position", [figw-margin-btnw margin btnw btnh],... + "fontsize", 12,... + "tag","convertbtn",... + "callback","cb_m2sci_gui"); + + // Cancel button + cancelbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Cancel"),... + "position",[figw-2*margin-2*btnw margin btnw btnh],... + "fontsize", 12,... + "tag", "cancelbtn",... + "callback","cb_m2sci_gui"); + + //---------------- + // --- Options --- + //---------------- + // Frame + optframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "units", "pixels",... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Options"), "left", "top", createBorderFont("", 11, "normal"), "black"),... + "position", [margin 2*margin+btnh figw-2*margin 5*margin+4*widgeth]); + + // --- Pretty print option --- + pplabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Generate pretty printed code: "),... + "position",[2*margin 2*margin+btnh+margin 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + ppradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 2*margin+btnh+margin 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "ppradioyes"); + ppradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 2*margin+btnh+margin 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "ppradiono"); + + // --- Verbose option --- + verby = 2*margin+btnh+margin+widgeth+margin; + verblabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Verbose mode: "),... + "position",[2*margin verby 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + verbradio0 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("0"),... + "position",[2*margin+300 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio0"); + verbradio1 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("1"),... + "position",[2*margin+300+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio1"); + verbradio2 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("2"),... + "position",[2*margin+300+60+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio2"); + verbradio3 = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("3"),... + "position",[2*margin+300+60+60+60 verby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "verbradio3"); + + // --- Only doubles option --- + douby = verby + margin + widgeth; + doublabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Only double values used: "),... + "position",[2*margin douby 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + doubradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 douby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "doubradioyes"); + doubradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 douby 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "doubradiono"); + + // --- Recursive mode option --- + recy = douby + margin + widgeth; + reclabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Recursive conversion: "),... + "position",[2*margin recy 280 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + recradioyes = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Yes"),... + "position",[2*margin+300 recy 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_m2sci_gui",... + "tag", "recradioyes"); + recradiono = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("No"),... + "position",[2*margin+360 recy 60 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_m2sci_gui",... + "tag", "recradiono"); + + // ------------------------ + // --- Output directory --- + // ------------------------ + // Frame + optframemaxy = 2*margin+btnh + 5*margin+4*widgeth; + outframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "position", [margin optframemaxy+margin figw-2*margin widgeth+2*margin],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Output directory"),"left","top",createBorderFont("", 11, "normal"), "black")); + + outlabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Directory name: "),... + "position",[2*margin optframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12); + outedit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", pwd(),... + "units", "pixels",... + "position",[3*margin+100 optframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "tag", "outedit"); + + outbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw optframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "callback", "cb_m2sci_gui",... + "tag", "outbtn"); + + // -------------------------------- + // --- File/Directory selection --- + // -------------------------------- + // Frame + outframemaxy = optframemaxy + 2*margin + widgeth + margin; + selframe = uicontrol("parent", m2scifig,... + "relief", "groove",... + "style", "frame",... + "units", "pixels",... + "position", [margin outframemaxy+margin figw-2*margin 2*margin+widgeth],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Input file"),"left","top",createBorderFont("", 11, "normal"), "black"),... + "tag", "filedirselect"); + + // --- Directory selection --- + dirlabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("Directory name: "),... + "position",[2*margin outframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "visible", "off",... + "tag", "dirlabel"); + diredit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", pwd(),... + "position",[3*margin+100 outframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12,... + "tag", "diredit",... + "visible", "off",... + "tag", "diredit"); + dirbtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw outframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "visible", "off",... + "callback", "cb_m2sci_gui",... + "tag", "dirbtn"); + + // --- File selection --- + filelabel = uicontrol("parent", m2scifig,... + "style", "text",... + "string", gettext("File name: "),... + "position",[2*margin outframemaxy+2*margin-1 120 widgeth],... + "horizontalalignment", "left",... + "fontunits", "points",... + "fontsize", 12,... + "tag", "filelabel"); + + fileedit = uicontrol("parent", m2scifig,... + "style", "edit",... + "string", gettext("<enter a file name>"),... + "position",[3*margin+100 outframemaxy+2*margin-1 figw-6*margin-100-btnw widgeth],... + "fontunits", "points",... + "fontsize", 12,... + "tag", "fileedit"); + + filebtn = uicontrol("parent", m2scifig,... + "style", "pushbutton",... + "string", gettext("Browse"),... + "position",[figw-2*margin-btnw outframemaxy+1.9*margin btnw btnh],... + "fontsize", 12,... + "callback", "cb_m2sci_gui",... + "tag", "filebtn"); + + // ------------ + // --- Mode --- + // ------------ + // Frame + selframemaxy = outframemaxy + 2*margin + widgeth + margin; + modeframe = uicontrol("parent", m2scifig,... + "style", "frame",... + "position", [margin selframemaxy+margin figw-2*margin 2*margin+widgeth],... + "border", createBorder("titled", createBorder("line", "lightGray", 1),... + _("Conversion mode"), "left", "top", createBorderFont("", 11, "normal"), "black")); + + fileradio = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Convert a single file"),... + "position",[2*margin selframemaxy+2*margin (figw-5*margin)/2 widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "min", 0, ... + "max", 1, ... + "value", 1,... + "tag", "fileradio", ... + "callback", "cb_m2sci_gui"); + + dirradio = uicontrol("parent", m2scifig,... + "style", "radiobutton",... + "string", gettext("Convert a whole directory"),... + "position",[3*margin+(figw-5*margin)/2 selframemaxy+2*margin (figw-5*margin)/2 widgeth],... + "fontunits", "points",... + "fontsize", 12, ... + "min", 0, ... + "max", 1, ... + "value", 0,... + "tag", "dirradio", ... + "callback", "cb_m2sci_gui"); + +endfunction diff --git a/modules/m2sci/macros/matfile2sci.bin b/modules/m2sci/macros/matfile2sci.bin Binary files differnew file mode 100755 index 000000000..939b9246f --- /dev/null +++ b/modules/m2sci/macros/matfile2sci.bin diff --git a/modules/m2sci/macros/matfile2sci.sci b/modules/m2sci/macros/matfile2sci.sci new file mode 100755 index 000000000..10e5a85d8 --- /dev/null +++ b/modules/m2sci/macros/matfile2sci.sci @@ -0,0 +1,80 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ???? - INRIA - Serge STEER +// Copyright (C) 2009 - DIGITEO - 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 matfile2sci(mat_file_path, result_file_path, overwrite) + // Translate a Matlab MAT file into a Scilab file + // + // mat_file_path : path of the Matlab MAT file + // result_file_path : path of the generated Scilab file + // + //This function has been developed following the "MAT-File Format" description: + //www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf + + if ~with_module("matio") then + error(msprintf(gettext("%s: %s module is not installed.\n"), "matfile2sci", "matio")); + end + + [lhs,rhs]=argn(0) + if rhs<2 | rhs>3 then + error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "matfile2sci", 2, 3)); + end + + //overwrite is false by default + if rhs==2 + overwrite = %F; + end + + //overwrite must be a boolean + if type(overwrite)<>4 + error(msprintf(_("%s: Wrong type for argument #%d: Boolean matrix expected.\n"), "matfile2sci", 3)); + end + + if size(overwrite, "*")<>1 + error(msprintf(_("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), "matfile2sci", 3, 1, 1)); + end + + //--file opening + input_file_path = pathconvert(mat_file_path, %F, %T) + fdi=matfile_open(input_file_path, "r"); + fdo_path=pathconvert(result_file_path, %F, %T); + + //Wipe file if overwrite is true and the output file previously existed + if isfile(fdo_path) & overwrite + fdo = mopen(fdo_path, "wb"); + end + + //-- Read first variable + ierr = execstr("[Name, Matrix, Class] = matfile_varreadnext(fdi);", "errcatch"); + ierrsave = 0; + + if (ierr~=0) | ~exists("Name") + error(msprintf(_("%s: Could not read variables in %s"), "matfile2sci", input_file_path)) + end + + if Name=="" + error(msprintf(_("%s: Could not read variables in %s"), "matfile2sci", input_file_path)) + end + + //--loop on the stored variables + while Name<>"" & ierr==0 & ierrsave==0 + ierrsave = execstr(Name + " = Matrix; save(fdo_path, ""-append"", """+Name+""")", "errcatch") + if ierrsave==0 then + //-- Read next variable + ierr = execstr("[Name, Matrix, Class] = matfile_varreadnext(fdi);", "errcatch"); + end + end + + if exists("fdo")==1 + mclose(fdo); + end + + //--file closing + matfile_close(fdi); +endfunction diff --git a/modules/m2sci/macros/mfile2sci.bin b/modules/m2sci/macros/mfile2sci.bin Binary files differnew file mode 100755 index 000000000..dc26aa6af --- /dev/null +++ b/modules/m2sci/macros/mfile2sci.bin diff --git a/modules/m2sci/macros/mfile2sci.sci b/modules/m2sci/macros/mfile2sci.sci new file mode 100755 index 000000000..cade50470 --- /dev/null +++ b/modules/m2sci/macros/mfile2sci.sci @@ -0,0 +1,353 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// Copyright (C) ???? - INRIA - Serge STEER +// +// 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 res=mfile2sci(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) + // This function performs translation of a single M-file + // - fil: file name + // - res_path: path to write translated file in (default value is fil path) + // - Recmode: recursive mode (default value is false) + + // Get default arguments + [lhs,rhs]=argn(0) + if rhs<6 then prettyprintoutput=%F,end + if rhs<5 then verbose_mode=3,end + if rhs<4 then only_double=%T,end + if rhs<3 then Recmode=%F,end + if rhs<2 then res_path="./",end + if rhs<1 then m2sci_gui();res=[];return;end + if getos() == "Windows" then + fil=strsubst(fil,filesep(),"/") + res_path=strsubst(res_path,"\","/") + end + if part(res_path,length(res_path))<>"/" then + res_path=res_path+"/" + end + // Loads libraries related to m2sci + if exists("m2scikernellib")==0 then load("SCI/modules/m2sci/macros/kernel/lib"),end + if exists("m2scipercentlib")==0 then load("SCI/modules/m2sci/macros/percent/lib"),end + if exists("m2scisci_fileslib")==0 then load("SCI/modules/m2sci/macros/sci_files/lib"),end + + if multi_fun_file(fil,res_path,Recmode,only_double,verbose_mode,prettyprintoutput) then + res=1 + return + end + + // Get context + global("m2sci_infos") + global("mtlbref_fun") + global("mtlbtool_fun") + global("not_mtlb_fun") + [l,mac]=where() + Reclevel=size(find(mac=="mfile2sci"),"*") + tpcallpos=min(find(mac=="translatepaths")); + guicallpos=min(find(mac=="m2sci_gui")); + if size(find(mac=="m2sci_gui"),"*")==1 & tpcallpos<guicallpos then // Bug 679 + Reclevel=Reclevel-1 + end + if size(find(mac=="multi_fun_file"),"*")==1 then + Reclevel=Reclevel-1 + end + + if Reclevel==1 then + nametbl=[] + else + m2sci_infos_save=m2sci_infos + end + m2sci_infos=[%f %f] + + margin=part(" ",ones(1,3*(Reclevel-1))) + margin=" " + rec=gettext("OFF"); + dble=gettext("NO"); + pretty=gettext("NO"); + if prettyprintoutput then pretty=gettext("YES");end + if Recmode then rec=gettext("ON");end + if only_double then dble=gettext("YES");end + + res=[] + + // Handle file path + // File name + k=strindex(fil,".") + if k<>[] + ke=k($)-1 + base_name=part(fil,1:ke) + else + ke=length(fil) + base_name=fil + end + // File path + k=strindex(fil,"/") + if k==[] then + file_path="./" + else + file_path=part(fil,1:k($)) + end + // Others M-files in directory + if exists("Paths")==0 then + Paths=file_path, + if getos() == "Windows" then + Paths=strsubst(Paths,"/","\") + mfiles=listfiles(Paths+"*.m") + sep=filesep() + else + mfiles=listfiles(Paths+"*.m") + sep=filesep() + end + end + + // Function name + fnam=part(base_name,k($)+1:ke) // File name without extension + + // logfile initialisation + if exists("logfile")==0 then + [tempfd1,ierr1]=file("open",pathconvert(TMPDIR)+"logfile.dat","old") + if ierr1==0 then + load(pathconvert(TMPDIR)+"logfile.dat") + file("close",tempfd1) + file("close",logfile) + mdelete(pathconvert(TMPDIR)+"logfile.dat") + end + logfile=file("open",res_path+"m2sci_"+fnam+".log","unknown") + save(pathconvert(TMPDIR)+"logfile.dat", "logfile") + end + + // Output beginning message + mss=[gettext("****** Beginning of mfile2sci() session ******"); + gettext("File to convert:")+" "+fil; + gettext("Result file path:")+" "+res_path; + gettext("Recursive mode:")+" "+rec; + gettext("Only double values used in M-file:")+" "+dble; + gettext("Verbose mode:")+" "+string(verbose_mode); + gettext("Generate formated code:")+" "+pretty] + m2sci_info(mss,-1); + + // Read in the file as text + m2sci_info(gettext("M-file reading..."),-1); + txt=mgetl(fil); + m2sci_info(gettext("M-file reading: Done"),-1); + + //Replace TAB by SPACE + txt=strsubst(txt, ascii(9), ""); + + if txt==[] then + m2sci_infos(msprintf(gettext("File %s is an empty file.\n"),fil),-1); + return + end + tmptxt=txt + + // Make minor changes on syntax + m2sci_info(gettext("Syntax modification..."),-1); + ierr=execstr("load(''"+pathconvert(TMPDIR)+fnam+ ".tree'',''txt'',''helppart'',''batch'')","errcatch","n") + if ierr<>0 | exists("txt")==0 | exists("batch")==0 & strindex(res_path,TMPDIR)==[] then + [helppart,txt,batch]=m2sci_syntax(txt) + elseif ierr==0 & newest(fil,pathconvert(TMPDIR)+fnam+ ".tree")==1 then + [helppart,txt,batch]=m2sci_syntax(tmptxt) + end + + m2sci_info(gettext("Syntax modification: Done"),-1); + + // Write .cat file and update whatis + if helppart<>[] then + catfil=res_path+fnam+".cat" + whsfil=res_path+"whatis" + mputl(helppart,catfil); + if exists("whsfil_unit")==1 then + write(whsfil_unit,stripblanks(helppart(1))+" |"+fnam,"(a)") + end + end + + if txt~=[] then + quote="''"; + dquote=""""; + kc=strindex(txt(1),"function"); + kc=kc(1); + + // Define Scilab function + fprot=funcprot(); + funcprot(0); + + // Blanks in file name are replaced by _ for batch + // kc+9 because 'function ' + ksc=min(strindex(txt(1),";")) // searching for a comment on first line after function prototype + if isempty(ksc) then + ksc=length(txt(1))+1; + firstline=[] + else + firstline=part(txt(1),ksc+1:length(txt(1))); + end + + func_proto=part(txt(1),kc+9:ksc-1) + keq=min(strindex(func_proto,"=")) + kpar=min(strindex(func_proto,"(")) + if isempty(keq) then + keq=1 + end + if isempty(kpar) then + kpar=length(func_proto)+1 + end + func_proto=part(func_proto,1:keq)+.. + strsubst(stripblanks(part(func_proto,keq+1:kpar-1))," ","_")+.. + part(func_proto,kpar:length(func_proto)) + + deff(func_proto,[firstline;txt(2:$)],"n") + w=who("get"); + mname=w(1); + nametbl=[nametbl;mname] + if fnam<>mname & ~batch then // warning is not displayed for a batch file + mss=msprintf(gettext("Warning: file %s defines function %s instead of %s\n %s.sci, %s.cat and sci_%s.sci will be generated !"),fil,mname,fnam,mname,mname,mname); + m2sci_info(mss,-1); + end + + txt($+1) = "endfunction" + // Compilation + txt = [part(txt(1),kc:ksc-1);firstline;txt(2:$)] + mputl(txt, TMPDIR+"/"+mname+".sci"); + exec(TMPDIR+"/"+mname+".sci", -1); + funcprot(fprot); + mdelete(TMPDIR+"/"+mname+".sci"); + + // Get Scilab pseudo code of the function + m2sci_info(gettext("Macro to tree conversion..."),-1); + macr=evstr(mname) + mtlbtree=macr2tree(macr); + if ~batch then + mtlbtree.name=mname; + else + mtlbtree.name=""; + end + + //Transfom a equal instructions(if lhs are multi_operation insert and expression is a funcall) in the matlab tree to sup_equal instructions + global("tmpvarnb") + tmpvarnb=0; + level=[0,0]; + ninstr=1; + while ninstr<=size(mtlbtree.statements)-3 + mtlbtree.statements(ninstr)=transformtree(mtlbtree.statements(ninstr)) + ninstr=ninstr+1 + end + + // Perform the translation + [scitree,trad,hdr,crp]=m2sci(mtlbtree,w(1),Recmode,prettyprintoutput) + + //Creation of fname_resume.log file + // if mtlbref_fun<>[]|not_mtlb_fun<>[]|mtlbtool_fun<>[] then + //resume_logfile initialisation + if exists("resume_logfile")==0 then + [tempfd2,ierr2]=file("open",pathconvert(TMPDIR)+gettext("resumelogfile.dat"),"old") + if ierr2==0 then + load(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + file("close",tempfd2) + file("close",resume_logfile) + mdelete(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + end + resume_logfile=file("open",res_path+gettext("resume")+"_m2sci_"+fnam+".log","unknown") + save(pathconvert(TMPDIR)+gettext("resumelogfile.dat"), "resume_logfile") + end + + //number of matlab reference functions, matlab toolboxes functions, not matlab functions + size1=size(mtlbref_fun,1) + size2=size(mtlbtool_fun,1) + size3=size(not_mtlb_fun,1) + + if size(mtlbref_fun,"*")<>0 then + mtlbref_fun(:,1)=""""+mtlbref_fun(:,1)+"""" + end + if size(mtlbtool_fun,"*")<>0 then + mtlbtool_fun(:,1)=""""+mtlbtool_fun(:,1)+"""" + end + if size(not_mtlb_fun,"*")<>0 then + not_mtlb_fun(:,1)=""""+not_mtlb_fun(:,1)+"""" + end + + info_resume=[msprintf(gettext("****** %s: Functions of mfile2sci() session ******"),fnam); + "*"; + msprintf(gettext("%d Matlab Function(s) not yet converted, original calling sequence used:"),size1); + mtlbref_fun(:,1)+mtlbref_fun(:,2); + "*"; + msprintf(gettext("%d Matlab Toolbox(es) Functions, original calling sequence used :"),size2); + mtlbtool_fun(:,1)+mtlbtool_fun(:,2); + "*"; + msprintf(gettext("%d Unknown Function(s), original calling sequence used :"),size3); + not_mtlb_fun(:,1)+not_mtlb_fun(:,2); + "*"] + + write(resume_logfile,margin+info_resume) + file("close",resume_logfile) + mdelete(pathconvert(TMPDIR)+gettext("resumelogfile.dat")) + //end + + m2sci_info(gettext("Macro to tree conversion: Done"),-1); + + crp(1)=""; // Delete function prototype + if isempty(firstline) then + res=[hdr;crp] + else + hdr(1)=hdr(1)+" "+crp(2); + crp(2)=[]; + res=[hdr;crp]; + end + + // Strip last return and blank lines + n=size(res,1) + while res(n)==part(" ",1:length(res(n))) then + n=n-1 + end + res=res(1:n) + + // Write sci-file + ext=".sci" + scifil=res_path+fnam+ext + mputl(res,scifil); + + // Write sci_<mname>.sci translation file + if trad<>[] then + sci_fil=res_path+"sci_"+mname+".sci" + mputl(trad,sci_fil); + res=1 + else + res=0 + end + + // Output summary information + infos=[] + if m2sci_infos(1) then + infos=gettext("Translation may be improved: see the //! comments and for all mtlb_<funname> function call\n Type help mtlb_<funname> in Scilab command window to get information about improvements."); + end + if m2sci_infos(2) then + infos=[infos;gettext("Translation may be wrong (see the //!! comments).")] + end + + nametbl($)=[] + + else + infos=gettext("File contains no instruction, no translation made..."); + end + + // End of translation messages + mss=gettext("****** End of mfile2sci() session ******"); + + m2sci_info([infos;mss],-1); + + if Reclevel>1 then + m2sci_infos=m2sci_infos_save + end + + file("close",logfile) + clearglobal m2sci_infos + clearglobal mtlbref_fun + clearglobal mtlbtool_fun + clearglobal not_mtlb_fun + // For execution called by translatepaths() + //nametbl=resume(nametbl) + mdelete(pathconvert(TMPDIR)+fnam+ ".tree") + mdelete(pathconvert(TMPDIR)+"logfile.dat") + +endfunction diff --git a/modules/m2sci/macros/names b/modules/m2sci/macros/names new file mode 100755 index 000000000..d673a3406 --- /dev/null +++ b/modules/m2sci/macros/names @@ -0,0 +1,5 @@ +cb_m2sci_gui +m2sci_gui +matfile2sci +mfile2sci +translatepaths 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 diff --git a/modules/m2sci/macros/sci_files/GEN b/modules/m2sci/macros/sci_files/GEN new file mode 100755 index 000000000..30ce3b01e --- /dev/null +++ b/modules/m2sci/macros/sci_files/GEN @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) ???? - INRIA - Scilab +# +# This file is distributed under the same license as the Scilab package. +# +# GEN prototype Matlab_fun_name Scilab_fun_name +sed -e "s/Prototype.*$/File generated from $1: PLEASE DO NOT EDIT !/" -e "s/MFUN/$2/g" -e "s/SFUN/$3/g" $1 + diff --git a/modules/m2sci/macros/sci_files/Makeproto b/modules/m2sci/macros/sci_files/Makeproto new file mode 100755 index 000000000..9bc2d1e87 --- /dev/null +++ b/modules/m2sci/macros/sci_files/Makeproto @@ -0,0 +1,200 @@ +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) ???? - INRIA - Scilab +# +# This file is distributed under the same license as the Scilab package. + +# This Makefile is used to build sci_funname.sci files from PROTOx.g + +PROTO0 = sci_abs.sci sci_cos.sci sci_cosh.sci sci_erf.sci sci_erfc.sci\ + sci_erfcx.sci sci_gamma.sci sci_gammaln.sci sci_imag.sci sci_real.sci +PROTO1 = sci_max.sci sci_min.sci +PROTO2 = sci_cumprod.sci sci_cumsum.sci +PROTO3 = sci_eye.sci sci_false.sci sci_ones.sci sci_rand.sci sci_randn.sci sci_true.sci sci_zeros.sci +PROTO4 = sci_acosh.sci sci_asinh.sci sci_conj.sci sci_cot.sci sci_coth.sci sci_double.sci sci_exp.sci sci_expm.sci sci_inv.sci sci_log.sci sci_log10.sci sci_sign.sci sci_sin.sci sci_sinh.sci sci_sqrt.sci sci_tan.sci sci_tanh.sci +PROTO5 = sci_asin.sci sci_atanh.sci sci_atan.sci +PROTO6 = sci_ceil.sci sci_fix.sci sci_floor.sci sci_round.sci +PROTO7 = sci_tril.sci sci_triu.sci +PROTO8 = sci_prod.sci sci_sum.sci +PROTO9 = sci_int8.sci sci_int16.sci sci_int32.sci sci_uint8.sci sci_uint16.sci sci_uint32.sci +PROTO10 = sci_lower.sci sci_upper.sci +PROTO11 = sci_dos.sci sci_unix.sci +PROTO12 = sci_who.sci sci_whos.sci +PROTO13 = sci_all.sci sci_any.sci +PROTO14 = sci_acos.sci +PROTO15 = sci_nargin.sci sci_nargout.sci + +# Files generated from file : sci_PROTO0.g +sci_abs.sci: sci_PROTO0.g + @./GEN $? abs abs > $@ +sci_cos.sci: sci_PROTO0.g + @./GEN $? cos cos > $@ +sci_cosh.sci: sci_PROTO0.g + @./GEN $? cosh cosh > $@ +sci_erf.sci: sci_PROTO0.g + @./GEN $? erf erf > $@ +sci_erfc.sci: sci_PROTO0.g + @./GEN $? erfc erfc > $@ +sci_erfcx.sci: sci_PROTO0.g + @./GEN $? erfcx erfcx > $@ +sci_gamma.sci: sci_PROTO0.g + @./GEN $? gamma gamma > $@ +sci_gammaln.sci: sci_PROTO0.g + @./GEN $? gammaln gammaln > $@ +sci_imag.sci: sci_PROTO0.g + @./GEN $? imag imag > $@ +sci_real.sci: sci_PROTO0.g + @./GEN $? real real > $@ + +# Files generated from file : sci_PROTO1.g +sci_max.sci: sci_PROTO1.g + @./GEN $? max max > $@ +sci_min.sci: sci_PROTO1.g + @./GEN $? min min > $@ + +# Files generated from file : sci_PROTO2.g +sci_cumprod.sci: sci_PROTO2.g + @./GEN $? cumprod cumprod > $@ +sci_cumsum.sci: sci_PROTO2.g + @./GEN $? cumsum cumsum > $@ + +# Files generated from file : sci_PROTO3.g +sci_eye.sci: sci_PROTO3.g + @./GEN $? eye eye > $@ +sci_false.sci: sci_PROTO3.g + @./GEN $? false zeros > $@ +sci_ones.sci: sci_PROTO3.g + @./GEN $? ones ones > $@ +sci_rand.sci: sci_PROTO3.g + @./GEN $? rand rand > $@ +sci_randn.sci: sci_PROTO3.g + @./GEN $? randn rand > $@ +sci_true.sci: sci_PROTO3.g + @./GEN $? true ones > $@ +sci_zeros.sci: sci_PROTO3.g + @./GEN $? zeros zeros > $@ + +# Files generated from file : sci_PROTO4.g (Output property same as input) +sci_acosh.sci: sci_PROTO4.g + @./GEN $? acosh acosh > $@ +sci_asinh.sci: sci_PROTO4.g + @./GEN $? asinh asinh > $@ +sci_conj.sci: sci_PROTO4.g + @./GEN $? conj conj > $@ +sci_cot.sci: sci_PROTO4.g + @./GEN $? cot cotg > $@ +sci_coth.sci: sci_PROTO4.g + @./GEN $? coth coth > $@ +sci_double.sci: sci_PROTO4.g + @./GEN $? double double > $@ +sci_exp.sci: sci_PROTO4.g + @./GEN $? exp exp > $@ +sci_expm.sci: sci_PROTO4.g + @./GEN $? expm expm > $@ +sci_inv.sci: sci_PROTO4.g + @./GEN $? inv inv > $@ +sci_log.sci: sci_PROTO4.g + @./GEN $? log log > $@ +sci_log10.sci: sci_PROTO4.g + @./GEN $? log10 log10 > $@ +sci_sign.sci: sci_PROTO4.g + @./GEN $? sign sign > $@ +sci_sin.sci: sci_PROTO4.g + @./GEN $? sin sin > $@ +sci_sinh.sci: sci_PROTO4.g + @./GEN $? sinh sinh > $@ +sci_sqrt.sci: sci_PROTO4.g + @./GEN $? sqrt sqrt > $@ +sci_tan.sci: sci_PROTO4.g + @./GEN $? tan tan > $@ +sci_tanh.sci: sci_PROTO4.g + @./GEN $? tanh tanh > $@ + +# Files generated from file : sci_PROTO5.g +sci_asin.sci: sci_PROTO5.g + @./GEN $? asin asin > $@ +sci_atan.sci: sci_PROTO5.g + @./GEN $? atan atan > $@ +sci_atanh.sci: sci_PROTO5.g + @./GEN $? atanh atanh > $@ + +# Files generated from file : sci_PROTO6.g +sci_ceil.sci: sci_PROTO6.g + @./GEN $? ceil ceil > $@ +sci_fix.sci: sci_PROTO6.g + @./GEN $? fix fix > $@ +sci_floor.sci: sci_PROTO6.g + @./GEN $? floor floor > $@ +sci_round.sci: sci_PROTO6.g + @./GEN $? round round > $@ + +# Files generated from file : sci_PROTO7.g +sci_tril.sci: sci_PROTO7.g + @./GEN $? tril tril > $@ +sci_triu.sci: sci_PROTO7.g + @./GEN $? triu triu > $@ + +# Files generated from file : sci_PROTO8.g +sci_prod.sci: sci_PROTO8.g + @./GEN $? prod prod > $@ +sci_sum.sci: sci_PROTO8.g + @./GEN $? sum sum > $@ + +# Files generated from file : sci_PROTO9.g +sci_int8.sci: sci_PROTO9.g + @./GEN $? int8 int8 > $@ +sci_int16.sci: sci_PROTO9.g + @./GEN $? int16 int16 > $@ +sci_int32.sci: sci_PROTO9.g + @./GEN $? int32 int32 > $@ +sci_uint8.sci: sci_PROTO9.g + @./GEN $? uint8 uint8 > $@ +sci_uint16.sci: sci_PROTO9.g + @./GEN $? uint16 uint16 > $@ +sci_uint32.sci: sci_PROTO9.g + @./GEN $? uint32 uint32 > $@ + +# Files generated from file : sci_PROTO10.g +sci_lower.sci: sci_PROTO10.g + @./GEN $? lower convstr > $@ +sci_upper.sci: sci_PROTO10.g + @./GEN $? upper convstr > $@ + +# Files generated from file : sci_PROTO11.g +sci_dos.sci: sci_PROTO11.g + @./GEN $? dos unix_g > $@ +sci_unix.sci: sci_PROTO11.g + @./GEN $? unix unix_g > $@ + +# Files generated from file : sci_PROTO12.g +sci_who.sci: sci_PROTO12.g + @./GEN $? who who > $@ +sci_whos.sci: sci_PROTO12.g + @./GEN $? whos whos > $@ + +# Files generated from file : sci_PROTO13.g +sci_any.sci: sci_PROTO13.g + @./GEN $? any or > $@ +sci_all.sci: sci_PROTO13.g + @./GEN $? all and > $@ + +# Files generated from file : sci_PROTO14.g +sci_acos.sci: sci_PROTO14.g + @./GEN $? acos acos > $@ + +# Files generated from file : sci_PROTO15.g +sci_nargin.sci: sci_PROTO15.g + @./GEN $? nargin nargin > $@ +sci_nargout.sci: sci_PROTO15.g + @./GEN $? nargout nargout > $@ + +all: $(PROTO0) $(PROTO1) $(PROTO2) $(PROTO3) $(PROTO4) \ + $(PROTO5) $(PROTO6) $(PROTO7) $(PROTO8) $(PROTO9) \ + $(PROTO10) $(PROTO11) $(PROTO12) $(PROTO13) $(PROTO14) \ + $(PROTO15) + +distclean :: + -rm -f $(PROTO0) $(PROTO1) $(PROTO2) $(PROTO3) $(PROTO4) $(PROTO5) $(PROTO6) $(PROTO7) $(PROTO8) $(PROTO9) $(PROTO10) $(PROTO11) $(PROTO12) $(PROTO13) $(PROTO14) $(PROTO15) + + + + diff --git a/modules/m2sci/macros/sci_files/buildmacros.sce b/modules/m2sci/macros/sci_files/buildmacros.sce new file mode 100755 index 000000000..83cc5ddaf --- /dev/null +++ b/modules/m2sci/macros/sci_files/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("m2scisci_fileslib","SCI/modules/m2sci/macros/sci_files",%f,%t); +//------------------------------------ diff --git a/modules/m2sci/macros/sci_files/lib b/modules/m2sci/macros/sci_files/lib Binary files differnew file mode 100755 index 000000000..97d382027 --- /dev/null +++ b/modules/m2sci/macros/sci_files/lib diff --git a/modules/m2sci/macros/sci_files/names b/modules/m2sci/macros/sci_files/names new file mode 100755 index 000000000..27872732f --- /dev/null +++ b/modules/m2sci/macros/sci_files/names @@ -0,0 +1,271 @@ +sci_abs +sci_acos +sci_acosh +sci_acot +sci_acoth +sci_acsc +sci_acsch +sci_all +sci_angle +sci_any +sci_asec +sci_asech +sci_asin +sci_asinh +sci_atan +sci_atan2 +sci_atanh +sci_axis +sci_balance +sci_bar +sci_barh +sci_beep +sci_besseli +sci_besselj +sci_besselk +sci_bessely +sci_beta +sci_bin2dec +sci_bitand +sci_bitor +sci_blanks +sci_box +sci_break +sci_cd +sci_ceil +sci_cell +sci_cell2mat +sci_cellstr +sci_char +sci_chol +sci_cla +sci_clc +sci_clear +sci_clf +sci_clock +sci_close +sci_closereq +sci_colordef +sci_cond +sci_conj +sci_continue +sci_conv +sci_conv2 +sci_cos +sci_cosh +sci_cot +sci_coth +sci_cov +sci_cputime +sci_csc +sci_csch +sci_cumprod +sci_cumsum +sci_date +sci_dec2bin +sci_dec2hex +sci_delete +sci_det +sci_diag +sci_diary +sci_diff +sci_dir +sci_disp +sci_display +sci_doc +sci_docopt +sci_dos +sci_double +sci_drawnow +sci_echo +sci_eig +sci_eomday +sci_erf +sci_erfc +sci_erfcx +sci_error +sci_etime +sci_eval +sci_exist +sci_exit +sci_exp +sci_expm +sci_eye +sci_factor +sci_factorial +sci_false +sci_fclose +sci_feof +sci_ferror +sci_feval +sci_fft +sci_fft2 +sci_fftshift +sci_fgetl +sci_fgets +sci_fileparts +sci_filesep +sci_find +sci_findstr +sci_fix +sci_fliplr +sci_flipud +sci_floor +sci_fopen +sci_format +sci_fprintf +sci_fread +sci_frewind +sci_fscanf +sci_fseek +sci_ftell +sci_full +sci_fullfile +sci_fwrite +sci_gamma +sci_gammaln +sci_getenv +sci_global +sci_graymon +sci_grid +sci_hankel +sci_help +sci_helpbrowser +sci_helpdesk +sci_helpwin +sci_hess +sci_hold +sci_home +sci_horzcat +sci_ifft +sci_imag +sci_input +sci_int16 +sci_int32 +sci_int8 +sci_interp1 +sci_inv +sci_isa +sci_iscell +sci_ischar +sci_isdir +sci_isempty +sci_isequal +sci_isfield +sci_isfinite +sci_isglobal +sci_ishandle +sci_ishold +sci_isinf +sci_isinteger +sci_isletter +sci_islogical +sci_isnan +sci_isnumeric +sci_ispc +sci_isreal +sci_isscalar +sci_isspace +sci_issparse +sci_isstr +sci_isstruct +sci_isunix +sci_isvector +sci_keyboard +sci_kron +sci_legendre +sci_length +sci_linspace +sci_load +sci_log +sci_log10 +sci_log2 +sci_logical +sci_logm +sci_lookfor +sci_lower +sci_lu +sci_makecell +sci_max +sci_mean +sci_median +sci_meshgrid +sci_min +sci_mkdir +sci_mod +sci_more +sci_nargin +sci_nargout +sci_ndims +sci_norm +sci_now +sci_num2str +sci_ones +sci_orth +sci_pause +sci_perms +sci_pie +sci_plot +sci_pow2 +sci_primes +sci_prod +sci_qr +sci_quit +sci_rand +sci_randn +sci_rcond +sci_real +sci_realmax +sci_realmin +sci_rem +sci_repmat +sci_reshape +sci_return +sci_round +sci_save +sci_schur +sci_setstr +sci_sign +sci_sin +sci_sinh +sci_size +sci_sort +sci_sortrows +sci_sparse +sci_sqrt +sci_str2num +sci_strcmp +sci_strcmpi +sci_strfind +sci_strrep +sci_struct +sci_subplot +sci_sum +sci_surf +sci_svd +sci_tan +sci_tanh +sci_tic +sci_title +sci_toc +sci_toeplitz +sci_tril +sci_triu +sci_true +sci_type +sci_uigetdir +sci_uint16 +sci_uint32 +sci_uint8 +sci_unix +sci_upper +sci_vertcat +sci_waitforbuttonpress +sci_warning +sci_who +sci_whos +sci_winqueryreg +sci_xlabel +sci_ylabel +sci_zeros +sci_zlabel diff --git a/modules/m2sci/macros/sci_files/sci_PROTO0.g b/modules/m2sci/macros/sci_files/sci_PROTO0.g new file mode 100755 index 000000000..f025f567e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO0.g @@ -0,0 +1,23 @@ +// 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]=sci_MFUN(tree) +// Generic conversion function +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO1.g b/modules/m2sci/macros/sci_files/sci_PROTO1.g new file mode 100755 index 000000000..f25e8a7d4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO1.g @@ -0,0 +1,169 @@ +// 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]=sci_MFUN(tree) +// Prototype for max and min +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// C = MFUN(A) or [C,I] = MFUN(A) +if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = MFUN(A) or [C,I] = MFUN(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab MFUN() does not work with complexes so mtlb_MFUN() is called + tree.name="mtlb_MFUN" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab MFUN() does not work with complexes so mtlb_MFUN() is called but can be replaced + tree.name="mtlb_MFUN" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = MFUN(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end +// C = MFUN(A,B) +elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end +// C = MFUN(A,[],dim) or [C,I] = MFUN(A,[],dim) +else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = MFUN(A,[],dim) or [C,I] = MFUN(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab MFUN() does not work when dim is greater than number of dims of A + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_MFUN" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = MFUN(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO10.g b/modules/m2sci/macros/sci_files/sci_PROTO10.g new file mode 100755 index 000000000..e3df4efa1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO10.g @@ -0,0 +1,37 @@ +// 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]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +opt=part("MFUN",1) + +A = getrhs(tree) +if A.vtype==String then + tree.name="SFUN" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +elseif A.vtype==Unknown then + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO11.g b/modules/m2sci/macros/sci_files/sci_PROTO11.g new file mode 100755 index 000000000..8142821f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO11.g @@ -0,0 +1,49 @@ +// 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]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +if rhs==2 then + tree.rhs(2)=null() +end + +if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end +else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO12.g b/modules/m2sci/macros/sci_files/sci_PROTO12.g new file mode 100755 index 000000000..3d5ad4f76 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO12.g @@ -0,0 +1,37 @@ +// 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]=sci_MFUN(tree) +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +k=1 +while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 +end + +if size(tree.rhs)==0 then + // Nothing to do +else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end +end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO13.g b/modules/m2sci/macros/sci_files/sci_PROTO13.g new file mode 100755 index 000000000..215e01755 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO13.g @@ -0,0 +1,98 @@ +// 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]=sci_MFUN(tree) +// Prototype for all and any +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +tree.name="SFUN" + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // %c_SFUN and %b_SFUN are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // %c_SFUN and %b_SFUN are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO14.g b/modules/m2sci/macros/sci_files/sci_PROTO14.g new file mode 100755 index 000000000..36f8a1e92 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO14.g @@ -0,0 +1,23 @@ +// 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]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property unknown +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO15.g b/modules/m2sci/macros/sci_files/sci_PROTO15.g new file mode 100755 index 000000000..7417d7c49 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO15.g @@ -0,0 +1,36 @@ +// 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]=sci_MFUN(tree) +// Prototype for functions nargin and nargout +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +global("varslist") + +if rhs==0 then // Number of arguments of local function + tree=Variable("%MFUN",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("MFUN","%MFUN",Infer(list(1,1),Type(Double,Real))) +else // Number of arguments of M-file + if "MFUN"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO2.g b/modules/m2sci/macros/sci_files/sci_PROTO2.g new file mode 100755 index 000000000..93570dbd5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO2.g @@ -0,0 +1,73 @@ +// 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]=sci_MFUN(tree) +// Prototype for cumsum and cumprod +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"SFUN"),1) + return + end + end + + tree.name="mtlb_MFUN" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO3.g b/modules/m2sci/macros/sci_files/sci_PROTO3.g new file mode 100755 index 000000000..8281759d3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO3.g @@ -0,0 +1,176 @@ +// 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]=sci_MFUN(tree) +// Prototype for eye false ones rand randn true zeros +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// Used for false and true +name_sav=tree.name + +if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return +end + +if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return +end + +// Special cases for rand and randn +if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end +end + +opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + +// MFUN(n) +if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("SFUN",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // MFUN([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("SFUN",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // MFUN(n) or MFUN([n1,n2,...]) ? + else + tree.name="mtlb_MFUN" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + +// MFUN(n1,n2,..) +else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="SFUN" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) +end + +if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) +end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_PROTO4.g b/modules/m2sci/macros/sci_files/sci_PROTO4.g new file mode 100755 index 000000000..c66645ab0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO4.g @@ -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]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property same as input +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +tree.name="SFUN" + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO5.g b/modules/m2sci/macros/sci_files/sci_PROTO5.g new file mode 100755 index 000000000..6e67b2c55 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO5.g @@ -0,0 +1,29 @@ +// 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]=sci_MFUN(tree) +// Prototype for: atanh asin atan +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) +else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) +end + +tree.lhs(1).dims=A.dims +tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO6.g b/modules/m2sci/macros/sci_files/sci_PROTO6.g new file mode 100755 index 000000000..755fd57bd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO6.g @@ -0,0 +1,27 @@ +// 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]=sci_MFUN(tree) +// Prototype for functions with same syntax and output property unknown when input is complex +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree + +A=getrhs(tree) +A=convert2double(A) +tree.rhs=Rhs_tlist(A) + +tree.lhs(1).dims=A.dims +if is_real(A) then + tree.lhs(1).type=Type(Double,Real) +else + tree.lhs(1).type=Type(Double,Unknown) +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO7.g b/modules/m2sci/macros/sci_files/sci_PROTO7.g new file mode 100755 index 000000000..bfe28e774 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO7.g @@ -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]=sci_MFUN(tree) +// Prototype for: triu tril +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// L = MFUN(X,k) +if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) +// L = MFUN(X) +else + X = getrhs(tree) +end + +// Common part +if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_MFUN" +else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end +end + +if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type +else + tree.lhs(1).type=Type(X.vtype,Unknown) +end +tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO8.g b/modules/m2sci/macros/sci_files/sci_PROTO8.g new file mode 100755 index 000000000..bd4c8e613 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO8.g @@ -0,0 +1,82 @@ +// 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]=sci_MFUN(tree) +// Prototype for sum prod and mean +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// B = MFUN(A) +if rhs==1 then + A = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end + +// B = MFUN(A,dim) +else + [A,dim] = getrhs(tree) + + // Because %b_SFUN and %C_SFUN are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab SFUN() does not work when dim is greater than number of dims A + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_PROTO9.g b/modules/m2sci/macros/sci_files/sci_PROTO9.g new file mode 100755 index 000000000..2c0d13a02 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_PROTO9.g @@ -0,0 +1,55 @@ +// 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]=sci_MFUN(tree) +// Prototype for *int**() +// M2SCI function +// Conversion function for Matlab MFUN() +// Input: tree = Matlab funcall tree +// Output: tree = Scilab equivalent for tree +// Emulation function: mtlb_MFUN() + +// %c_MFUN and %b_MFUN are not defined in Scilab +x = getrhs(tree) + +// Matlab MFUN() can return Boolean type value +if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown +else + vtype=Int +end + +x = convert2double(x) + +tree.rhs=Rhs_tlist(x) + +if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"MFUN","MFUN"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x +elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"MFUN","MFUN"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x +else + tree.name="mtlb_MFUN" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type +end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_abs.bin b/modules/m2sci/macros/sci_files/sci_abs.bin Binary files differnew file mode 100755 index 000000000..69121b911 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_abs.bin diff --git a/modules/m2sci/macros/sci_files/sci_abs.sci b/modules/m2sci/macros/sci_files/sci_abs.sci new file mode 100755 index 000000000..96f913540 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_abs.sci @@ -0,0 +1,23 @@ +// 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]=sci_abs(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab abs() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acos.bin b/modules/m2sci/macros/sci_files/sci_acos.bin Binary files differnew file mode 100755 index 000000000..db5fd788c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acos.bin diff --git a/modules/m2sci/macros/sci_files/sci_acos.sci b/modules/m2sci/macros/sci_files/sci_acos.sci new file mode 100755 index 000000000..95a469526 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acos.sci @@ -0,0 +1,23 @@ +// 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]=sci_acos(tree) + // File generated from sci_PROTO14.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab acos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acosh.bin b/modules/m2sci/macros/sci_files/sci_acosh.bin Binary files differnew file mode 100755 index 000000000..88cc4c272 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acosh.bin diff --git a/modules/m2sci/macros/sci_files/sci_acosh.sci b/modules/m2sci/macros/sci_files/sci_acosh.sci new file mode 100755 index 000000000..a0c84c915 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acosh.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]=sci_acosh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab acosh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="acosh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acot.bin b/modules/m2sci/macros/sci_files/sci_acot.bin Binary files differnew file mode 100755 index 000000000..3c829d8f1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acot.bin diff --git a/modules/m2sci/macros/sci_files/sci_acot.sci b/modules/m2sci/macros/sci_files/sci_acot.sci new file mode 100755 index 000000000..9990714c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acot.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=sci_acot(tree) + // M2SCI function + // Conversion function for Matlab acot() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="atan" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acoth.bin b/modules/m2sci/macros/sci_files/sci_acoth.bin Binary files differnew file mode 100755 index 000000000..aacafe602 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acoth.bin diff --git a/modules/m2sci/macros/sci_files/sci_acoth.sci b/modules/m2sci/macros/sci_files/sci_acoth.sci new file mode 100755 index 000000000..9b27c22d6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acoth.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=sci_acoth(tree) + // M2SCI function + // Conversion function for Matlab acoth() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(X),expression2code(tree)),2) + + tree.name="atanh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + // Property unknown because result can be complex for real input + tree.lhs(1).type=Type(X.vtype,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acsc.bin b/modules/m2sci/macros/sci_files/sci_acsc.bin Binary files differnew file mode 100755 index 000000000..69f578b81 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsc.bin diff --git a/modules/m2sci/macros/sci_files/sci_acsc.sci b/modules/m2sci/macros/sci_files/sci_acsc.sci new file mode 100755 index 000000000..b85f018ea --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsc.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=sci_acsc(tree) + // M2SCI function + // Conversion function for Matlab acsc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="asin" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_acsch.bin b/modules/m2sci/macros/sci_files/sci_acsch.bin Binary files differnew file mode 100755 index 000000000..56a64a386 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsch.bin diff --git a/modules/m2sci/macros/sci_files/sci_acsch.sci b/modules/m2sci/macros/sci_files/sci_acsch.sci new file mode 100755 index 000000000..44abe317e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_acsch.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=sci_acsch(tree) + // M2SCI function + // Conversion function for Matlab acsch() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="asinh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_all.bin b/modules/m2sci/macros/sci_files/sci_all.bin Binary files differnew file mode 100755 index 000000000..c45c4059f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_all.bin diff --git a/modules/m2sci/macros/sci_files/sci_all.sci b/modules/m2sci/macros/sci_files/sci_all.sci new file mode 100755 index 000000000..1571eaf61 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_all.sci @@ -0,0 +1,98 @@ +// 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]=sci_all(tree) + // File generated from sci_PROTO13.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab all() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_all() + + tree.name="and" + + // B = all(A) + if rhs==1 then + A = getrhs(tree) + + // %c_and and %b_and are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_all" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + + // B = all(A,dim) + else + [A,dim] = getrhs(tree) + + // %c_and and %b_and are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_all" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_all" + tree.lhs(1).dims=allunknown(A.dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_angle.bin b/modules/m2sci/macros/sci_files/sci_angle.bin Binary files differnew file mode 100755 index 000000000..510727e7a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_angle.bin diff --git a/modules/m2sci/macros/sci_files/sci_angle.sci b/modules/m2sci/macros/sci_files/sci_angle.sci new file mode 100755 index 000000000..1528b6457 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_angle.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=sci_angle(tree) + // M2SCI function + // Conversion function for Matlab angle() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + + if typeof(A)=="variable" then + n=A + else + n=gettempvar() + insert(Equal(list(n),A)) + end + + realpart=Funcall("real",1,list(n),list()) + imagpart=Funcall("imag",1,list(n),list()) + + tree=Funcall("atan",1,list(imagpart,realpart),tree.lhs) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_any.bin b/modules/m2sci/macros/sci_files/sci_any.bin Binary files differnew file mode 100755 index 000000000..c7e798d9e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_any.bin diff --git a/modules/m2sci/macros/sci_files/sci_any.sci b/modules/m2sci/macros/sci_files/sci_any.sci new file mode 100755 index 000000000..c23b4f09e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_any.sci @@ -0,0 +1,98 @@ +// 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]=sci_any(tree) + // File generated from sci_PROTO13.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab any() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_any() + + tree.name="or" + + // B = any(A) + if rhs==1 then + A = getrhs(tree) + + // %c_or and %b_or are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A) + + // if A is not a multidimensional array + if size(A.dims)==2 then + if is_a_vector(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,1) + tree.lhs(1).dims=list(1,A.dims(2)) + else + tree.name="mtlb_any" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // if A is a multidimensional array + else + dim = first_non_singleton(A) + if dim<>Unknown then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + newrhs=Funcall("firstnonsingleton",1,list(A),list()) + tree.rhs=Rhs_tlist(A,newrhs) + tree.lhs(1).dims=allunknown(A.dims) + end + end + tree.lhs(1).type=Type(Boolean,Real) + + // B = any(A,dim) + else + [A,dim] = getrhs(tree) + + // %c_or and %b_or are not defined + A = convert2double(A) + + if is_complex(A) then + A = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + elseif ~is_real(A) then + newA = Funcall("abs",1,Rhs_tlist(A),list(Variable("",A.infer))) + repl_poss(newA,A,A,gettext("is Real.")) + A=newA + end + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + tree.lhs(1).type=Type(Boolean,Real) + else + if not_empty(A) then + tree=Operation("<>",list(A,Cste(0)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_any" + tree.lhs(1).dims=A.dims + end + end + else + tree.name="mtlb_any" + tree.lhs(1).dims=allunknown(A.dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asec.bin b/modules/m2sci/macros/sci_files/sci_asec.bin Binary files differnew file mode 100755 index 000000000..1f878bd0c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asec.bin diff --git a/modules/m2sci/macros/sci_files/sci_asec.sci b/modules/m2sci/macros/sci_files/sci_asec.sci new file mode 100755 index 000000000..b9cc29875 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asec.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=sci_asec(tree) + // M2SCI function + // Conversion function for Matlab asec() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="acos" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asech.bin b/modules/m2sci/macros/sci_files/sci_asech.bin Binary files differnew file mode 100755 index 000000000..ad9e62c57 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asech.bin diff --git a/modules/m2sci/macros/sci_files/sci_asech.sci b/modules/m2sci/macros/sci_files/sci_asech.sci new file mode 100755 index 000000000..74220878e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asech.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=sci_asech(tree) + // M2SCI function + // Conversion function for Matlab asech() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + tree.name="acosh" + Op=Operation("./",list(Cste(1),X),list()) + tree.rhs=Rhs_tlist(Op) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asin.bin b/modules/m2sci/macros/sci_files/sci_asin.bin Binary files differnew file mode 100755 index 000000000..a234eddbc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asin.bin diff --git a/modules/m2sci/macros/sci_files/sci_asin.sci b/modules/m2sci/macros/sci_files/sci_asin.sci new file mode 100755 index 000000000..052da34e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asin.sci @@ -0,0 +1,29 @@ +// 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]=sci_asin(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab asin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_asinh.bin b/modules/m2sci/macros/sci_files/sci_asinh.bin Binary files differnew file mode 100755 index 000000000..3d3a252c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asinh.bin diff --git a/modules/m2sci/macros/sci_files/sci_asinh.sci b/modules/m2sci/macros/sci_files/sci_asinh.sci new file mode 100755 index 000000000..da1a1ed3a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_asinh.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]=sci_asinh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab asinh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="asinh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atan.bin b/modules/m2sci/macros/sci_files/sci_atan.bin Binary files differnew file mode 100755 index 000000000..bd1db2120 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan.bin diff --git a/modules/m2sci/macros/sci_files/sci_atan.sci b/modules/m2sci/macros/sci_files/sci_atan.sci new file mode 100755 index 000000000..687f2009a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan.sci @@ -0,0 +1,29 @@ +// 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]=sci_atan(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab atan() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atan2.bin b/modules/m2sci/macros/sci_files/sci_atan2.bin Binary files differnew file mode 100755 index 000000000..3a7b2be2a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan2.bin diff --git a/modules/m2sci/macros/sci_files/sci_atan2.sci b/modules/m2sci/macros/sci_files/sci_atan2.sci new file mode 100755 index 000000000..94d2687d6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atan2.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]=sci_atan2(tree) + // M2SCI function + // Conversion function for Matlab atan2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_atan and %b_atan are not defined in Scilab + [Y,X]=getrhs(tree) + //Y=convert2double(Y) + //X=convert2double(X) + tree.rhs=Rhs_tlist(Y,X) + + // Scilab atan() does not work with complex + if is_complex(Y) then + tree.rhs(1)=Funcall("real",1,list(Y),list()) + elseif ~is_real(Y) then + tree.rhs(1)=Funcall("real",1,list(Y),list()) + repl_poss(tree.rhs(1),Y,Y,"is real") + end + if is_complex(X) then + tree.rhs(2)=Funcall("real",1,list(X),list()) + elseif ~is_real(X) then + tree.rhs(2)=Funcall("real",1,list(X),list()) + repl_poss(tree.rhs(2),X,X,"is real") + end + + tree.name="atan" + + tree.lhs(1).dims=Y.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_atanh.bin b/modules/m2sci/macros/sci_files/sci_atanh.bin Binary files differnew file mode 100755 index 000000000..e267e5649 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atanh.bin diff --git a/modules/m2sci/macros/sci_files/sci_atanh.sci b/modules/m2sci/macros/sci_files/sci_atanh.sci new file mode 100755 index 000000000..5470460c7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_atanh.sci @@ -0,0 +1,29 @@ +// 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]=sci_atanh(tree) + // File generated from sci_PROTO5.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab atanh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + if tree.name=="atan" then + set_infos(msprintf(gettext("If %s is outside [-1,1]\n real part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + else + set_infos(msprintf(gettext("If %s is outside [-1,1]\n complex part of output of %s will be the opposite of Matlab one."),expression2code(A),expression2code(tree)),2) + end + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_axis.bin b/modules/m2sci/macros/sci_files/sci_axis.bin Binary files differnew file mode 100755 index 000000000..81290dc7f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_axis.bin diff --git a/modules/m2sci/macros/sci_files/sci_axis.sci b/modules/m2sci/macros/sci_files/sci_axis.sci new file mode 100755 index 000000000..aafb31bda --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_axis.sci @@ -0,0 +1,126 @@ +// 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=sci_axis(tree) + // M2SCI function + // Conversion function for Matlab axis() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Insert %v0=gca() + a=Funcall("gca",1,list(),list()) + + if rhs>0 then + for krhs=1:rhs + if tree.rhs(krhs).vtype==Double then + + // axis([xmin xmax ymin ymax]) + // axis([xmin xmax ymin ymax zmin zmax]) + if or(tree.rhs(krhs).dims(2)==[4,6]) then + mat=Funcall("matrix",1,list(tree.rhs(krhs),Cste(2),Cste(-1)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"data_bounds",mat),tree.lhs) + + // axis([xmin xmax ymin ymax zmin zmax cmin cmax]) + elseif tree.rhs(krhs).dims(2)==8 then + no_equiv(expression2code(tree)) + + // Unknown column number for tree.rhs(krhs) + else + tree.name="mtlb_axis" + end + elseif tree.rhs(krhs).vtype==String then + + // Option is a character string + if typeof(tree.rhs(krhs))=="cste" then + + // axis auto + if tree.rhs(krhs).value=="auto" then + tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","on"),tree.lhs) + + // axis manual + elseif tree.rhs(krhs).value=="manual" then + tree=Funcall("set",1,Rhs_tlist(a,"auto_scale","off"),tree.lhs) + + // axis tight + elseif tree.rhs(krhs).value=="tight" then + tree=Funcall("set",1,Rhs_tlist(a,"tight_limits","on"),tree.lhs) + + // axis fill + elseif tree.rhs(krhs).value=="fill" then + no_equiv(expression2code(tree)) + + // axis ij + elseif tree.rhs(krhs).value=="ij" then + mat=Operation("cc",list(Cste(180),Cste(270)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs) + + // axis xy + elseif tree.rhs(krhs).value=="xy" then + mat=Operation("cc",list(Cste(0),Cste(270)),list()) + tree=Funcall("set",1,Rhs_tlist(a,"rotation_angles",mat),tree.lhs) + + // axis equal + elseif tree.rhs(krhs).value=="equal" then + tree=Funcall("set",1,Rhs_tlist(a,"isoview","on"),tree.lhs) + + // axis image + elseif tree.rhs(krhs).value=="image" then + no_equiv(expression2code(tree)) + + // axis square + elseif tree.rhs(krhs).value=="square" then + set_infos(gettext("cube_scaling only used in 3d mode."),2); + tree=Funcall("set",1,Rhs_tlist(a,"cube_scaling","on"),tree.lhs) + + // axis vis3d + elseif tree.rhs(krhs).value=="vis3d" then + tree=Funcall("set",1,Rhs_tlist(a,"view","3d"),tree.lhs) + + // axis normal + elseif tree.rhs(krhs).value=="normal" then + no_equiv(expression2code(tree)) + + // axis on + elseif tree.rhs(krhs).value=="on" then + tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","on"),tree.lhs) + + // axis off + elseif tree.rhs(krhs).value=="off" then + tree=Funcall("set",1,Rhs_tlist(a,"axes_visible","off"),tree.lhs) + + // [mode,visibility,direction] = axis('state') + elseif tree.rhs(krhs).value=="state" then + tree.name="mtlb_axis" + + // Unknown character string + else + tree.name="mtlb_axis" + end + + // Option is a variable + else + tree.name="mtlb_axis" + end + + // axis(axes_handles,...) + elseif tree.rhs(krhs).vtype==Handle then + no_equiv(expression2code(tree)) + + // Unknown type for tree.rhs(krhs) + else + tree.name="mtlb_axis" + end + end + // v = axis + else + tree=Funcall("set",1,Rhs_tlist(a,"data_bounds"),tree.lhs) + tree.lhs(1).dims=list(2,Unknown) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_balance.bin b/modules/m2sci/macros/sci_files/sci_balance.bin Binary files differnew file mode 100755 index 000000000..00a6527b2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_balance.bin diff --git a/modules/m2sci/macros/sci_files/sci_balance.sci b/modules/m2sci/macros/sci_files/sci_balance.sci new file mode 100755 index 000000000..8fa05e4cf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_balance.sci @@ -0,0 +1,48 @@ +// 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]=sci_balance(tree) + // M2SCI function + // Conversion function for Matlab balance() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + + // %c_balance and %b_balance are not defined + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.name="balanc" + + // B=balance(A) + if lhs==1 then + if tree.lhs(1).name=="ans" then + B=gettempvar(1) + T=gettempvar(2) + insert(Equal(list(B,T),tree)) + tree=B + else + T=gettempvar(2) + tree.lhs=list(tree.lhs(1),T) + end + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + // [T,B] = balance(A) + else + tree.lhs=list(tree.lhs(2),tree.lhs(1)) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bar.bin b/modules/m2sci/macros/sci_files/sci_bar.bin Binary files differnew file mode 100755 index 000000000..67ea0f2a9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bar.bin diff --git a/modules/m2sci/macros/sci_files/sci_bar.sci b/modules/m2sci/macros/sci_files/sci_bar.sci new file mode 100755 index 000000000..ee25ced11 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bar.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_bar(tree) + // M2SCI function + // Conversion function for Matlab bar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_barh.bin b/modules/m2sci/macros/sci_files/sci_barh.bin Binary files differnew file mode 100755 index 000000000..5007e08c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_barh.bin diff --git a/modules/m2sci/macros/sci_files/sci_barh.sci b/modules/m2sci/macros/sci_files/sci_barh.sci new file mode 100755 index 000000000..c3b9d4231 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_barh.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_barh(tree) + // M2SCI function + // Conversion function for Matlab barh() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_beep.bin b/modules/m2sci/macros/sci_files/sci_beep.bin Binary files differnew file mode 100755 index 000000000..4f38106cc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beep.bin diff --git a/modules/m2sci/macros/sci_files/sci_beep.sci b/modules/m2sci/macros/sci_files/sci_beep.sci new file mode 100755 index 000000000..0bd3356b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beep.sci @@ -0,0 +1,19 @@ +// 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]=sci_beep(tree) + // M2SCI function + // Conversion function for Matlab beep + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown); + tree.lhs(1).type=Type(String,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besseli.bin b/modules/m2sci/macros/sci_files/sci_besseli.bin Binary files differnew file mode 100755 index 000000000..40243ea4e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besseli.bin diff --git a/modules/m2sci/macros/sci_files/sci_besseli.sci b/modules/m2sci/macros/sci_files/sci_besseli.sci new file mode 100755 index 000000000..e98f1bcef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besseli.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_besseli(tree) + // M2SCI function + // Conversion function for Matlab besseli() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besseli(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besseli(alpha,x) + elseif rhs==3 then //besseli(alpha,x,) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besselj.bin b/modules/m2sci/macros/sci_files/sci_besselj.bin Binary files differnew file mode 100755 index 000000000..a831abae1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselj.bin diff --git a/modules/m2sci/macros/sci_files/sci_besselj.sci b/modules/m2sci/macros/sci_files/sci_besselj.sci new file mode 100755 index 000000000..52571bddf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselj.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_besselj(tree) + // M2SCI function + // Conversion function for Matlab besselj() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besselj(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besselj(alpha,x) + elseif rhs==3 then // y=besselj(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_besselk.bin b/modules/m2sci/macros/sci_files/sci_besselk.bin Binary files differnew file mode 100755 index 000000000..715d461a1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselk.bin diff --git a/modules/m2sci/macros/sci_files/sci_besselk.sci b/modules/m2sci/macros/sci_files/sci_besselk.sci new file mode 100755 index 000000000..f7788aefc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_besselk.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_besselk(tree) + // M2SCI function + // Conversion function for Matlab besselk() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=besselk(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=besselk(alpha,x) + elseif rhs==3 then // y=besselk(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bessely.bin b/modules/m2sci/macros/sci_files/sci_bessely.bin Binary files differnew file mode 100755 index 000000000..3d13bfccf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bessely.bin diff --git a/modules/m2sci/macros/sci_files/sci_bessely.sci b/modules/m2sci/macros/sci_files/sci_bessely.sci new file mode 100755 index 000000000..72896ea90 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bessely.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_bessely(tree) + // M2SCI function + // Conversion function for Matlab bessely() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==2 then // [y,ierr]=bessely(alpha,x) + error(gettext("Bessel function is not implemented for 2 outputs arguments.")) + end + + if rhs==2 then + [A,B]=getrhs(tree) // y=bessely(alpha,x) + elseif rhs==3 then // y=bessely(alpha,x,1) + [A,B,C]=getrhs(tree) + end + + A=convert2double(A) + B=convert2double(B) + + if is_real(B) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_empty(A) | is_empty(B) then // A or B is an empty + tree.lhs(1).dims=list(0,0) + elseif is_a_scalar(A) then // A is a scalar + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) then// B is a scalar + tree.lhs(1).dims=A.dims + else + Aknowndim=%t // boolean false if A dimension is unknown + Bknowndim=%t // boolean false if B dimension is unknown + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + for i=1:size(B.dims) + if B.dims(i)==-1 then + Bknowndim=%f + break + end + end + if is_a_vector(A) then // A is a vector + if is_a_vector(B) then // B is a vector + if A.dims==B.dims then // both A and B are column vectors or both A and B are line vectors + tree.lhs(1).dims=B.dims + else // A is a line vector and B is a column vector, or A is a column vector and B is a line vector + tree.lhs(1).dims(1)=B.dims(1)*B.dims(2) + tree.lhs(1).dims(2)=A.dims(1)*A.dims(2) + end + end + elseif ~(Aknowndim & Bknowndim) then // A or B dimension(s) is unknown + tree.lhs(1).dims==list(-1,-1) + elseif A.dims==B.dims then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims==list(-1,-1) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_beta.bin b/modules/m2sci/macros/sci_files/sci_beta.bin Binary files differnew file mode 100755 index 000000000..852deb8ec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beta.bin diff --git a/modules/m2sci/macros/sci_files/sci_beta.sci b/modules/m2sci/macros/sci_files/sci_beta.sci new file mode 100755 index 000000000..f1a900eb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_beta.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]=sci_beta(tree) + // M2SCI function + // Conversion function for Matlab beta() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [A,B]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + tree.rhs=list(A,B) + + if is_a_scalar(A) & not_a_scalar(B) then // A is a scalar but not B + n=gettempvar() + insert(Equal(list(n),B)) + insert(Equal(list(Operation("ins",list(n,Cste(":")),list())),A)) + tree.rhs(1)=n + tree.lhs(1).dims=B.dims + elseif is_a_scalar(B) & not_a_scalar(A) then // B is be a scalar but not A + n=gettempvar() + insert(Equal(list(n),A)) + insert(Equal(list(Operation("ins",list(n,Cste(":")),list())),B)) + tree.rhs(2)=n + tree.lhs(1).dims=A.dims + elseif is_a_scalar(A) & is_a_scalar(B) then // Both A and B are scalars + elseif not_a_scalar(A) & not_a_scalar(B) then // A and B have the same size + else + tree.name="mtlb_beta" + end + + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bin2dec.bin b/modules/m2sci/macros/sci_files/sci_bin2dec.bin Binary files differnew file mode 100755 index 000000000..7df7f529a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bin2dec.bin diff --git a/modules/m2sci/macros/sci_files/sci_bin2dec.sci b/modules/m2sci/macros/sci_files/sci_bin2dec.sci new file mode 100755 index 000000000..822f8e44d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bin2dec.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_bin2dec(tree) + // M2SCI function + // Conversion function for Matlab bin2dec() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(tree.rhs(1).dims(1),1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bitand.bin b/modules/m2sci/macros/sci_files/sci_bitand.bin Binary files differnew file mode 100755 index 000000000..aeafa4eec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitand.bin diff --git a/modules/m2sci/macros/sci_files/sci_bitand.sci b/modules/m2sci/macros/sci_files/sci_bitand.sci new file mode 100755 index 000000000..da336d3c0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitand.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_bitand(tree) + // M2SCI function + // Conversion function for Matlab bitand() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_bitor.bin b/modules/m2sci/macros/sci_files/sci_bitor.bin Binary files differnew file mode 100755 index 000000000..13ec762b1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitor.bin diff --git a/modules/m2sci/macros/sci_files/sci_bitor.sci b/modules/m2sci/macros/sci_files/sci_bitor.sci new file mode 100755 index 000000000..4d66c93a3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_bitor.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_bitor(tree) + // M2SCI function + // Conversion function for Matlab bitor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_blanks.bin b/modules/m2sci/macros/sci_files/sci_blanks.bin Binary files differnew file mode 100755 index 000000000..af5292d90 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_blanks.bin diff --git a/modules/m2sci/macros/sci_files/sci_blanks.sci b/modules/m2sci/macros/sci_files/sci_blanks.sci new file mode 100755 index 000000000..b8b7387ea --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_blanks.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 [tree]=sci_blanks(tree) + // M2SCI function + // Conversion function for Matlab blanks() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + + if ~is_a_scalar(A) & typeof(A)<>"variable" then + n=gettempvar() + insert(Equal(list(n),A)) + B=Operation("ext",list(n,Cste(1)),list()) + repl_poss(B,.. + A,A,gettext("is a scalar.")) + elseif ~is_a_scalar(A) then + B=Operation("ext",list(A,Cste(1)),list()) + repl_poss(B,.. + A,A,gettext("is a scalar.")) + else + B=A + end + + tree.name="part" + ones_funcall=Funcall("ones",1,list(Cste(1),B),list()) + tree.rhs=list(Cste(" "),ones_funcall) + + if typeof(A)=="cste" then + tree.lhs(1).dims=list(1,A.value(1)) + else + tree.lhs(1).dims=list(1,Unknown) + end + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_box.bin b/modules/m2sci/macros/sci_files/sci_box.bin Binary files differnew file mode 100755 index 000000000..ded876f2e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_box.bin diff --git a/modules/m2sci/macros/sci_files/sci_box.sci b/modules/m2sci/macros/sci_files/sci_box.sci new file mode 100755 index 000000000..bdf9533b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_box.sci @@ -0,0 +1,44 @@ +// 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]=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 + tree.name="mtlb_box" + // box on/off + elseif rhs==1 then + if typeof(tree.rhs(1))=="cste" then + a=gettempvar() + insert(Equal(list(a),Funcall("gca",1,list(),list()))) + + LHS=Operation("ins",list(a,Cste("box")),list()) + insert(Equal(list(LHS),Cste(convstr(tree.rhs(1).value,"l")))) + + tree=list() + else + tree.name="mtlb_box" + end + + // box(axes_handle,...) + else + if typeof(tree.rhs(2))=="cste" then + LHS=Operation("ins",list(tree.rhs(1),Cste("box")),list()) + insert(Equal(list(LHS),Cste(convstr(tree.rhs(2).value,"l")))) + + tree=list() + else + tree.name="mtlb_box" + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_break.bin b/modules/m2sci/macros/sci_files/sci_break.bin Binary files differnew file mode 100755 index 000000000..af1e05df7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_break.bin diff --git a/modules/m2sci/macros/sci_files/sci_break.sci b/modules/m2sci/macros/sci_files/sci_break.sci new file mode 100755 index 000000000..84848563a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_break.sci @@ -0,0 +1,16 @@ +// 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]=sci_break(tree) + // M2SCI function + // Conversion function for Matlab break() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cd.bin b/modules/m2sci/macros/sci_files/sci_cd.bin Binary files differnew file mode 100755 index 000000000..520f1a8ca --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cd.bin diff --git a/modules/m2sci/macros/sci_files/sci_cd.sci b/modules/m2sci/macros/sci_files/sci_cd.sci new file mode 100755 index 000000000..ac47fdb4b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cd.sci @@ -0,0 +1,23 @@ +// 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]=sci_cd(tree) + // M2SCI function + // Conversion function for Matlab cd() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // cd + if rhs<=0 then + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + // cd(dirname) + else + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ceil.bin b/modules/m2sci/macros/sci_files/sci_ceil.bin Binary files differnew file mode 100755 index 000000000..5538b2cff --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ceil.bin diff --git a/modules/m2sci/macros/sci_files/sci_ceil.sci b/modules/m2sci/macros/sci_files/sci_ceil.sci new file mode 100755 index 000000000..fa1102934 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ceil.sci @@ -0,0 +1,27 @@ +// 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]=sci_ceil(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab ceil() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cell.bin b/modules/m2sci/macros/sci_files/sci_cell.bin Binary files differnew file mode 100755 index 000000000..23995ac9d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell.bin diff --git a/modules/m2sci/macros/sci_files/sci_cell.sci b/modules/m2sci/macros/sci_files/sci_cell.sci new file mode 100755 index 000000000..eefd4e458 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell.sci @@ -0,0 +1,79 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_cell(tree) + // M2SCI function + // Conversion function for Matlab cell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Cell,Unknown) + return + end + + // cell(n) + if rhs==1 then + n = getrhs(tree) + if is_complex(n) then + n=Funcall("real",1,list(n),list(Variable("",n.infer))) + elseif ~is_real(n) then + newn=Funcall("real",1,list(n),list(Variable("",n.infer))) + repl_poss(newn,n,n,gettext("is Real.")); + n=newn + end + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Cell,Unknown) + // cell([n1,n2,...]) + elseif not_a_scalar(n) + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + tree.lhs(1).type=Type(Cell,Unknown) + // cell(n) or cell([n1,n2,...]) ? + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Cell,Unknown) + end + + // cell(n1,n2,..) + else + for k=1:size(tree.rhs) + if is_complex(tree.rhs(k)) then + tree.rhs(k)=Funcall("real",1,list(tree.rhs(k)),list()) + elseif ~is_real(tree.rhs(k)) then + newn=Funcall("real",1,list(tree.rhs(k)),list()) + repl_poss(newn,tree.rhs(k),tree.rhs(k),gettext("is Real.")); + tree.rhs(k)=newn + end + end + + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Cell,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cell2mat.bin b/modules/m2sci/macros/sci_files/sci_cell2mat.bin Binary files differnew file mode 100755 index 000000000..83daaf1f4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell2mat.bin diff --git a/modules/m2sci/macros/sci_files/sci_cell2mat.sci b/modules/m2sci/macros/sci_files/sci_cell2mat.sci new file mode 100755 index 000000000..c5560aaa7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cell2mat.sci @@ -0,0 +1,40 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_cell2mat(tree) + // M2SCI function + // Conversion function for Matlab cell2mat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + if is_empty(A) then + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Double,Real) + elseif size(A.dims)==2 + if A.dims(1)<> -1 & A.dims(2)<> -1 then + lhs_dims2=0; + for i=1:A.dims(2) + lhs_dims2=A.contents.data(i).dims(2) + lhs_dims2 + end + lhs_dims1=0; + for i=1:A.dims(1) + lhs_dims1=A.contents.data(1+(i-1)*A.dims(2)).dims(1) + lhs_dims1 + end + tree.lhs(1).dims=list(lhs_dims1,lhs_dims2) + tree.lhs(1).type = A.contents.data(1).type + else + tree.lhs(1).dims=list(-1,-1) + tree.lhs(1).type=Type(Unknown,Unknown) + end + else + tree.lhs(1).dims=list(-1,-1) + tree.lhs(1).type=Type(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cellstr.bin b/modules/m2sci/macros/sci_files/sci_cellstr.bin Binary files differnew file mode 100755 index 000000000..c71ea6e8f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cellstr.bin diff --git a/modules/m2sci/macros/sci_files/sci_cellstr.sci b/modules/m2sci/macros/sci_files/sci_cellstr.sci new file mode 100755 index 000000000..d2c1a9647 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cellstr.sci @@ -0,0 +1,34 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_cellstr(tree) + // M2SCI function + // Conversion function for Matlab cellstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + Aknowndim=%t // Aknowndim is a boolean, true if all dimennsions of A are known + tree.lhs(1).dims=list() + for i=1:size(A.dims) + if A.dims(i)==-1 then + Aknowndim=%f + break + end + end + if ~Aknowndim then + tree.lhs(1).dims(1)=-1 + tree.lhs(1).dims(2)=1 + else + tree.lhs(1).dims(1)=A.dims(1) + tree.lhs(1).dims(2)=1 + end + tree.lhs(1).type=Type(Cell,Unknown) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_char.bin b/modules/m2sci/macros/sci_files/sci_char.bin Binary files differnew file mode 100755 index 000000000..67d9c583c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_char.bin diff --git a/modules/m2sci/macros/sci_files/sci_char.sci b/modules/m2sci/macros/sci_files/sci_char.sci new file mode 100755 index 000000000..ea9d3b805 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_char.sci @@ -0,0 +1,53 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_char(tree) + // M2SCI function + // Conversion function for Matlab char() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then // char(A) + A = getrhs(tree) + if A.vtype==1 | A.vtype==8 | A.vtype==10 then + tree.lhs(1).dims=tree.rhs(1).dims + // input is cell + elseif A.vtype==16 | A.vtype==17 then + if size(A.contents.data)>0 then + lhs_dims1=0; + lhs_dims2=0; + for i=1:size(A.contents.data) + if A.contents.data(i).dims(1)<>-1 & A.contents.data(i).dims(2)<>-1 then + lhs_dims1=lhs_dims1+A.contents.data(i).dims(1) + lhs_dims2=max(A.contents.data(i).dims(2),lhs_dims2) + else + lhs_dims1=-1; + lhs_dims2=-1; + end + end + tree.lhs(1).dims(1)=lhs_dims1; + tree.lhs(1).dims(2)=lhs_dims2; + end + elseif A.vtype==Unknown then + tree.lhs(1).dims=list(-1,-1); + else + error(msprintf(gettext("%s is not implemented."),string(A.vtype))) + end + elseif rhs>1 //char(t1,t2,t3,...) + lhs_dims1=0; + lhs_dims2=0; + for i=1:rhs + lhs_dims1=lhs_dims1+tree.rhs(i).dims(1) + lhs_dims2=max(tree.rhs(i).dims(2),lhs_dims2) + end + tree.lhs(1).dims(1)=lhs_dims1; + tree.lhs(1).dims(2)=lhs_dims2; + end + tree.lhs(1).type=Type(String,Real); +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_chol.bin b/modules/m2sci/macros/sci_files/sci_chol.bin Binary files differnew file mode 100755 index 000000000..4dd772b31 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_chol.bin diff --git a/modules/m2sci/macros/sci_files/sci_chol.sci b/modules/m2sci/macros/sci_files/sci_chol.sci new file mode 100755 index 000000000..aafba0f81 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_chol.sci @@ -0,0 +1,37 @@ +// 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]=sci_chol(tree) + // M2SCI function + // Conversion function for Matlab chol() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + if X.vtype==Sparse then + tree.name="spchol" + else + tree.name="chol" + end + + // %c_chol and %b_chol are not defined + X=convert2double(X) + tree.rhs=Rhs_tlist(X) + + // R = chol(X) + if lhs==1 then + tree.lhs(1).dims=X.dims + tree.lhs(1).type=X.type + // [R,p] = chol(X) + else + no_equiv(gettext("Call to chol() with 2 outputs.")) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cla.bin b/modules/m2sci/macros/sci_files/sci_cla.bin Binary files differnew file mode 100755 index 000000000..3a48a09d7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cla.bin diff --git a/modules/m2sci/macros/sci_files/sci_cla.sci b/modules/m2sci/macros/sci_files/sci_cla.sci new file mode 100755 index 000000000..40ddc4a9c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cla.sci @@ -0,0 +1,26 @@ +// 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]=sci_cla(tree) + // M2SCI function + // Conversion function for Matlab cla() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + set_infos(gettext("All children will be deleted, no HandleVisibility property in Scilab graphics."),2); + end + + // a=gca() + a=gettempvar() + insert(Equal(list(a),Funcall("gca",1,list(),list()))) + + tree.name="delete" + tree.rhs=list(Operation("ext",list(a,Cste("children")),list())) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clc.bin b/modules/m2sci/macros/sci_files/sci_clc.bin Binary files differnew file mode 100755 index 000000000..339fdea80 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clc.bin diff --git a/modules/m2sci/macros/sci_files/sci_clc.sci b/modules/m2sci/macros/sci_files/sci_clc.sci new file mode 100755 index 000000000..05c60be28 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clc.sci @@ -0,0 +1,17 @@ +// 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]=sci_clc(tree) + // M2SCI function + // Conversion function for Matlab clc + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.rhs=list() +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clear.bin b/modules/m2sci/macros/sci_files/sci_clear.bin Binary files differnew file mode 100755 index 000000000..292dd3373 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clear.bin diff --git a/modules/m2sci/macros/sci_files/sci_clear.sci b/modules/m2sci/macros/sci_files/sci_clear.sci new file mode 100755 index 000000000..199e70a01 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clear.sci @@ -0,0 +1,47 @@ +// 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]=sci_clear(tree) + // M2SCI function + // Conversion function for Matlab clear() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + for k=1:rhs + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + end + + if size(tree.rhs)==0 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + else + select tree.rhs(1).value + case "global" then + tree.rhs(1)=null() + tree.name="clearglobal" + case "all" then + tree.rhs=list() + case "classes" then + no_equiv(expression2code(tree)) + case "functions" then + no_equiv(expression2code(tree)) + case "import" then + no_equiv(expression2code(tree)) + case "variables" then + tree.rhs=list() + else + // Nothing to do + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clf.bin b/modules/m2sci/macros/sci_files/sci_clf.bin Binary files differnew file mode 100755 index 000000000..febbb8181 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clf.bin diff --git a/modules/m2sci/macros/sci_files/sci_clf.sci b/modules/m2sci/macros/sci_files/sci_clf.sci new file mode 100755 index 000000000..223749a13 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clf.sci @@ -0,0 +1,29 @@ +// 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]=sci_clf(tree) + // M2SCI function + // Conversion function for Matlab clf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + set_infos(gettext("All children will be deleted, no HandleVisibility property in Scilab graphics."),2); + end + if rhs==1 then + set_infos(gettext("All properties will be reset."),2); + end + + // f=gcf() inserted if output value stored in a variable + if tree.lhs(1).name<>"ans" then + f=tree.lhs(1) + insert(Equal(list(f),Funcall("gcf",1,list(),list())),1) + end + tree.lhs(1).name="ans" +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_clock.bin b/modules/m2sci/macros/sci_files/sci_clock.bin Binary files differnew file mode 100755 index 000000000..af1af9730 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clock.bin diff --git a/modules/m2sci/macros/sci_files/sci_clock.sci b/modules/m2sci/macros/sci_files/sci_clock.sci new file mode 100755 index 000000000..a20d8f3b2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_clock.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 [tree]=sci_clock(tree) + // M2SCI function + // Conversion function for Matlab clock() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + w = gettempvar() + elt1=Operation(":",list(Cste(1),Cste(2)),list()) + elt2=Operation(":",list(Cste(6),Cste(9)),list()) + row=Operation("rc",list(elt1,elt2),list()) + + // w = getdate(); + insert(Equal(list(w),Funcall("getdate",1,list(),list()))) + + // w(3:5)=[] (then w with 7 values) + imp=Operation(":",list(Cste(3),Cste(5)),list()) + w35=Operation("ins",list(w,imp),list()) + insert(Equal(list(w35),Cste([]))) + + // w(6)=w(6)+w(7)/1000 + w7=Operation("ext",list(w,Cste(7)),list()) + w6ext=Operation("ext",list(w,Cste(6)),list()) + w6ins=Operation("ext",list(w,Cste(6)),list()) + div=Operation("/",list(w7,Cste(1000)),list()) + add=Operation("+",list(w6ext,div),list()) + insert(Equal(list(w6ins),add)) + + // c= w(1:6) + imp=Operation(":",list(Cste(1),Cste(6)),list()) + tree=Operation("ext",list(w,imp),tree.lhs) + + tree.out(1).dims=list(1,6) + tree.out(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_close.bin b/modules/m2sci/macros/sci_files/sci_close.bin Binary files differnew file mode 100755 index 000000000..ee1a355da --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_close.bin diff --git a/modules/m2sci/macros/sci_files/sci_close.sci b/modules/m2sci/macros/sci_files/sci_close.sci new file mode 100755 index 000000000..d5806d62c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_close.sci @@ -0,0 +1,58 @@ +// 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]=sci_close(tree) + // M2SCI function + // Conversion function for Matlab close() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_close() + + global %graphicswindow + + if tree.lhs(1).name<>"ans" then + no_equiv(msprintf(gettext("%s will be ignored at run time."),tree.lhs(1).name)) + end + + // close + if rhs==0 then + if %graphicswindow==Handle then + tree.name="delete" + tree.rhs(1)=Funcall("gcf",1,list(),list()) + else + // Nothing changed + end + // close(h) - close('all') - close(name) + elseif rhs==1 then + h=tree.rhs(1) + if h.vtype==Handle then // close(h) + tree.name="delete" + elseif h.vtype==Double then // close(h) + // Nothing changed + elseif h.vtype==String then + if typeof(h)=="cste" then + if h.value=="all" then // close('all') + tree.name="xdel" + tree.rhs(1)=Funcall("winsid",1,list(),list()) + else // close(name) + tree.name="mtlb_close" + end + else + tree.name="mtlb_close" + end + else // Unknown type for h + tree.name="mtlb_close" + end + else // close('all','hidden') + set_infos(gettext("All windows will be deleted."),2); + tree.name="xdel" + tree.rhs(1)=Funcall("winsid",1,list(),list()) + tree.rhs(2)=null() + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_closereq.bin b/modules/m2sci/macros/sci_files/sci_closereq.bin Binary files differnew file mode 100755 index 000000000..ff89693fe --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_closereq.bin diff --git a/modules/m2sci/macros/sci_files/sci_closereq.sci b/modules/m2sci/macros/sci_files/sci_closereq.sci new file mode 100755 index 000000000..0ed564687 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_closereq.sci @@ -0,0 +1,20 @@ +// 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]=sci_closereq(tree) + // M2SCI function + // Conversion function for Matlab closereq + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="delete" + + tree.rhs(1)=Funcall("gcf",1,list(),list()) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_colordef.bin b/modules/m2sci/macros/sci_files/sci_colordef.bin Binary files differnew file mode 100755 index 000000000..0e4c80721 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_colordef.bin diff --git a/modules/m2sci/macros/sci_files/sci_colordef.sci b/modules/m2sci/macros/sci_files/sci_colordef.sci new file mode 100755 index 000000000..441eb7031 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_colordef.sci @@ -0,0 +1,86 @@ +// 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]=sci_colordef(tree) + // M2SCI function + // Conversion function for Matlab colordef() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if tree.lhs(1).name=="ans" then + f=gettempvar() + else + f=tree.lhs(1) + end + + // colordef color_option + if rhs==1 then + if typeof(tree.rhs(1))=="cste" then + if or(tree.rhs(1).value==["black","none"]) then + insert(Equal(list(f),Funcall("gcf",1,list(),list()))) + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + tree=list() + elseif tree.rhs(1).value=="white" then + insert(Equal(list(f),Funcall("gcf",1,list(),list()))) + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + tree=list() + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_colordef" + end + else + // colordef('new',color_opt) + if tree.rhs(1).vtype==String then + winsid_funcall=Funcall("winsid",1,list(),list()) + max_funcall=Funcall("max",1,list(winsid_funcall),list()) + addition=Operation("+",list(max_funcall,Cste(1)),list()) + scf_funcall=Funcall("scf",1,list(addition),list()) + insert(Equal(list(f),scf_funcall)) + if or(tree.rhs(2).value==["black","none"]) then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + tree=list() + elseif tree.rhs(2).value=="white" then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + tree=list() + else + no_equiv(expression2code(tree)) + end + + // colordef(fig,color_opt) + elseif tree.rhs(1).vtype==Handle then + f=tree.rhs(1) + if or(tree.rhs(2).value==["black","none"]) then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-1))) + if tree.lhs(1).name<>"ans" then + insert(Equal(list(tree.lhs(1)),f)) + end + tree=list() + elseif tree.rhs(2).value=="white" then + LHS=Operation("ins",list(f,Cste("background")),list()) + insert(Equal(list(LHS),Cste(-2))) + if tree.lhs(1).name<>"ans" then + insert(Equal(list(tree.lhs(1)),f)) + end + tree=list() + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_colordef" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cond.bin b/modules/m2sci/macros/sci_files/sci_cond.bin Binary files differnew file mode 100755 index 000000000..b309b0e19 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cond.bin diff --git a/modules/m2sci/macros/sci_files/sci_cond.sci b/modules/m2sci/macros/sci_files/sci_cond.sci new file mode 100755 index 000000000..065cacc3f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cond.sci @@ -0,0 +1,29 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_cond(tree) + // M2SCI function + // Conversion function for Matlab cond() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_cond() + + if rhs == 1 then + A = getrhs(tree); + for i=1:size(A.dims) + if A.dims(i) == -1 | A.dims(i) == 0 then + tree.name = "mtlb_cond"; + end + end + elseif rhs == 2 + tree.name = "mtlb_cond"; + end + tree.lhs(1).type = Type(Double,Real); + tree.lhs(1).dims =list(1,1); +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_conj.bin b/modules/m2sci/macros/sci_files/sci_conj.bin Binary files differnew file mode 100755 index 000000000..8ea67326b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conj.bin diff --git a/modules/m2sci/macros/sci_files/sci_conj.sci b/modules/m2sci/macros/sci_files/sci_conj.sci new file mode 100755 index 000000000..b30ca6524 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conj.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]=sci_conj(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab conj() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="conj" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_continue.bin b/modules/m2sci/macros/sci_files/sci_continue.bin Binary files differnew file mode 100755 index 000000000..52385b085 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_continue.bin diff --git a/modules/m2sci/macros/sci_files/sci_continue.sci b/modules/m2sci/macros/sci_files/sci_continue.sci new file mode 100755 index 000000000..651d2e249 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_continue.sci @@ -0,0 +1,16 @@ +// 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]=sci_continue(tree) + // M2SCI function + // Conversion function for Matlab continue + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_conv.bin b/modules/m2sci/macros/sci_files/sci_conv.bin Binary files differnew file mode 100755 index 000000000..0c363c56e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv.bin diff --git a/modules/m2sci/macros/sci_files/sci_conv.sci b/modules/m2sci/macros/sci_files/sci_conv.sci new file mode 100755 index 000000000..5810a6edd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv.sci @@ -0,0 +1,36 @@ +// 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]=sci_conv(tree) + // M2SCI function + // Conversion function for Matlab conv() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_conv() + + if rhs==2 then // conv(u,v) + [A,B]=getrhs(tree) // conv(u,v) + elseif rhs==3 then + [A,B,shape]=getrhs(tree) + end + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + if and([A.dims(1),B.dims(1)]==1)|(A.dims(2)==SupToOne&B.dims(2)==SupToOne)|(A.dims(2)>1&B.dims(2)>1) then //A and B row vectors + tree.lhs(1).dims=list(1,Unknown) + elseif and([A.dims(2),B.dims(2)]==1)|(A.dims(1)==SupToOne&B.dims(1)==SupToOne)|(A.dims(1)>1&B.dims(1)>1) then // A and B column vectors + tree.lhs(1).dims=list(Unknown,1) + else + tree.lhs(1).dims=list(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_conv2.bin b/modules/m2sci/macros/sci_files/sci_conv2.bin Binary files differnew file mode 100755 index 000000000..99ed2b8e8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv2.bin diff --git a/modules/m2sci/macros/sci_files/sci_conv2.sci b/modules/m2sci/macros/sci_files/sci_conv2.sci new file mode 100755 index 000000000..7fea4be73 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_conv2.sci @@ -0,0 +1,65 @@ +// 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]=sci_conv2(tree) + // M2SCI function + // Conversion function for Matlab conv2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then // conv2(A,B) + [A,B]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + elseif rhs==3 then + [A,B,C]=getrhs(tree) + if C.type==String then // conv(A,B,frame) + A=convert2double(A) + B=convert2double(B) + if is_real(A)&is_real(B) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + else // conv(u,v,B) + A=convert2double(A) + B=convert2double(B) + C=convert2double(C) + if is_real(A)&is_real(B)&is_real(C) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B)|is_complex(C) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + elseif rhs==4 then // conv(u,v,B, frame) + [A,B,C,D]=getrhs(tree) + A=convert2double(A) + B=convert2double(B) + C=convert2double(C) + if is_real(A)&is_real(B)&is_real(C) then + tree.lhs(1).type=Type(Double,Real) + elseif is_complex(A)|is_complex(B)|is_complex(C) then + tree.lhs(1).type=Type(Double,Complex) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + tree.lhs(1).dims=list(Unknown,Unknown); +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cos.bin b/modules/m2sci/macros/sci_files/sci_cos.bin Binary files differnew file mode 100755 index 000000000..f0964b35a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cos.bin diff --git a/modules/m2sci/macros/sci_files/sci_cos.sci b/modules/m2sci/macros/sci_files/sci_cos.sci new file mode 100755 index 000000000..36cb95930 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cos.sci @@ -0,0 +1,23 @@ +// 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]=sci_cos(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab cos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cosh.bin b/modules/m2sci/macros/sci_files/sci_cosh.bin Binary files differnew file mode 100755 index 000000000..ecf20105b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cosh.bin diff --git a/modules/m2sci/macros/sci_files/sci_cosh.sci b/modules/m2sci/macros/sci_files/sci_cosh.sci new file mode 100755 index 000000000..fb4e90ad0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cosh.sci @@ -0,0 +1,23 @@ +// 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]=sci_cosh(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab cosh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cot.bin b/modules/m2sci/macros/sci_files/sci_cot.bin Binary files differnew file mode 100755 index 000000000..541ef8032 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cot.bin diff --git a/modules/m2sci/macros/sci_files/sci_cot.sci b/modules/m2sci/macros/sci_files/sci_cot.sci new file mode 100755 index 000000000..8156291b2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cot.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]=sci_cot(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cot() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="cotg" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_coth.bin b/modules/m2sci/macros/sci_files/sci_coth.bin Binary files differnew file mode 100755 index 000000000..a55e5ce77 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_coth.bin diff --git a/modules/m2sci/macros/sci_files/sci_coth.sci b/modules/m2sci/macros/sci_files/sci_coth.sci new file mode 100755 index 000000000..7773441f1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_coth.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]=sci_coth(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab coth() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="coth" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cov.bin b/modules/m2sci/macros/sci_files/sci_cov.bin Binary files differnew file mode 100755 index 000000000..1d43ad5ef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cov.bin diff --git a/modules/m2sci/macros/sci_files/sci_cov.sci b/modules/m2sci/macros/sci_files/sci_cov.sci new file mode 100755 index 000000000..e6b7789d1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cov.sci @@ -0,0 +1,168 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_cov(tree) + // M2SCI function + // Conversion function for Matlab cov() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + A=getrhs(tree) + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name="mvvacov" + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name="mvvacov" + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + n = A.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + n = A.dims(1) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + elseif rhs == 2 then + [A,B] = getrhs(tree) + if B.dims(1) == 1 & B.dims(2) == 1 + if typeof(B) == "cste" & B.value == 1 then + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name = "mvvacov" + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + tree.rhs(2)=null() + tree.lhs(1).dims=list(A.dims(2),A.dims(2)) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + elseif typeof(B) == "cste" & B.value == 0 then + if A.dims(1) == 1 then + if A.dims(2) == 1 then + tree.name="mvvacov" + tree.rhs(2)=null() + tree.lhs(1).dims=list(1,1) + elseif A.dims(2) > 1 then + tree.name="mvvacov" + tree.rhs(2)=null() + tree.rhs(1) = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + n = A.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(2) == Unknown then + tree.name = "mtlb_cov" + end + elseif A.dims(1) > 1 then + tree.name = "mvvacov" + tree.rhs(2)=null() + n = A.dims(1) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif A.dims(1) == Unknown & A.dims(2) == Unknown + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + elseif B.dims(1)>1 | B.dims(2)>1 then + tree.name = "mvvacov" + n = B.dims(1)*B.dims(2) + n_minus = n-1 + tree.lhs(1).dims=list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(2) = null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + else + tree.name = "mtlb_cov" + end + elseif rhs==3 + [A,B,C]=getrhs(tree) + if typeof(C) == "cste" & C.value == 1 then + if B.dims(1)>1 | B.dims(2)>1 | A.dims(1)>1 | A.dims(2)>1 + tree.name = "mvvacov" + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3) = null() + tree.rhs(2) = null() + if A.dims(1)<> Unknown & A.dims(2)<>Unknown + tree.lhs(1).dims = list(A.dims(1)*A.dims(2),A.dims(1)*A.dims(2)) + elseif B.dims(1)<>Unknown & B.dims(2)<>Unknown + tree.lhs(1).dims = list(B.dims(1)*B.dims(2),B.dims(1)*B.dims(2)) + end + else + tree.name = "mtlb_cov" + end + elseif typeof(C) == "cste" & C.value == 0 then + if B.dims(1)>1 | B.dims(2)>1 | A.dims(1)>1 | A.dims(2)>1 + if A.dims(1)<>Unknown & A.dims(2)<>Unknown + tree.name = "mvvacov" + n = A.dims(1)*A.dims(2) + n_minus = n-1 + tree.lhs(1).dims = list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3)=null() + tree.rhs(2)=null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + elseif B.dims(1)<>Unknown & B.dims(2)<>Unknown + tree.name = "mvvacov" + n = B.dims(1)*B.dims(2) + n_minus = n-1 + tree.lhs(1).dims = list(n,n) + rhs1 = Funcall("matrix",1,list(A,Cste(-1),Cste(1)),list()) + rhs2 = Funcall("matrix",1,list(B,Cste(-1),Cste(1)),list()) + tree.rhs(1) = Operation("rc",list(rhs1,rhs2),list()) + tree.rhs(3)=null() + tree.rhs(2)=null() + op1 = Operation("/",list(Cste(n),Cste(n_minus)),list()) + tree = Operation("*",list(op1,tree),tree.lhs) + else + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + else + tree.name = "mtlb_cov" + end + end + +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_cputime.bin b/modules/m2sci/macros/sci_files/sci_cputime.bin Binary files differnew file mode 100755 index 000000000..c3ad74c1e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cputime.bin diff --git a/modules/m2sci/macros/sci_files/sci_cputime.sci b/modules/m2sci/macros/sci_files/sci_cputime.sci new file mode 100755 index 000000000..b942e921c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cputime.sci @@ -0,0 +1,20 @@ +// 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]=sci_cputime(tree) + // M2SCI function + // Conversion function for Matlab cputime() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="timer" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_csc.bin b/modules/m2sci/macros/sci_files/sci_csc.bin Binary files differnew file mode 100755 index 000000000..f7da639b7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csc.bin diff --git a/modules/m2sci/macros/sci_files/sci_csc.sci b/modules/m2sci/macros/sci_files/sci_csc.sci new file mode 100755 index 000000000..39ed08bda --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csc.sci @@ -0,0 +1,24 @@ +// 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=sci_csc(tree) + // M2SCI function + // Conversion function for Matlab csc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + sin_funcall=Funcall("sin",1,list(X),list()) + tree=Operation("./",list(Cste(1),sin_funcall),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Double,X.property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_csch.bin b/modules/m2sci/macros/sci_files/sci_csch.bin Binary files differnew file mode 100755 index 000000000..46a318aa3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csch.bin diff --git a/modules/m2sci/macros/sci_files/sci_csch.sci b/modules/m2sci/macros/sci_files/sci_csch.sci new file mode 100755 index 000000000..625257ac1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_csch.sci @@ -0,0 +1,24 @@ +// 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=sci_csch(tree) + // M2SCI function + // Conversion function for Matlab csch() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X=getrhs(tree) + X=convert2double(X) + + sinh_funcall=Funcall("sinh",1,list(X),list()) + tree=Operation("./",list(Cste(1),sinh_funcall),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Double,X.property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cumprod.bin b/modules/m2sci/macros/sci_files/sci_cumprod.bin Binary files differnew file mode 100755 index 000000000..24b912a4a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumprod.bin diff --git a/modules/m2sci/macros/sci_files/sci_cumprod.sci b/modules/m2sci/macros/sci_files/sci_cumprod.sci new file mode 100755 index 000000000..3e94b9c4c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumprod.sci @@ -0,0 +1,73 @@ +// 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]=sci_cumprod(tree) + // File generated from sci_PROTO2.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cumprod() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_cumprod() + + // B = cumprod(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_cumprod and %C_cumprod are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + // B = cumprod(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_cumprod and %C_cumprod are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"cumprod"),1) + return + end + end + + tree.name="mtlb_cumprod" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_cumsum.bin b/modules/m2sci/macros/sci_files/sci_cumsum.bin Binary files differnew file mode 100755 index 000000000..17367a13c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumsum.bin diff --git a/modules/m2sci/macros/sci_files/sci_cumsum.sci b/modules/m2sci/macros/sci_files/sci_cumsum.sci new file mode 100755 index 000000000..58cd29af9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_cumsum.sci @@ -0,0 +1,73 @@ +// 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]=sci_cumsum(tree) + // File generated from sci_PROTO2.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab cumsum() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_cumsum() + + // B = cumsum(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_cumsum and %C_cumsum are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + dim=first_non_singleton(A) + + tree.lhs(1).dims=A.dims + + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + elseif dim==-1 then + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + end + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + // B = cumsum(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_cumsum and %C_cumsum are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + if typeof(A)=="funcall" then + tree.lhs(1).infer=A.infer + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + tree.lhs(1).infer=A.infer + A.out=tree.lhs + end + tree=A; + set_infos(msprintf(gettext("Scilab %s() does not work when dim input argument is greater than number of dims of first rhs..."),"cumsum"),1) + return + end + end + + tree.name="mtlb_cumsum" + tree.lhs(1).dims=A.dims + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_date.bin b/modules/m2sci/macros/sci_files/sci_date.bin Binary files differnew file mode 100755 index 000000000..e95193f2d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_date.bin diff --git a/modules/m2sci/macros/sci_files/sci_date.sci b/modules/m2sci/macros/sci_files/sci_date.sci new file mode 100755 index 000000000..4c9c560c4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_date.sci @@ -0,0 +1,18 @@ +// 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=sci_date(tree) + // M2SCI function + // Conversion function for Matlab date() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,11) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dec2bin.bin b/modules/m2sci/macros/sci_files/sci_dec2bin.bin Binary files differnew file mode 100755 index 000000000..7b945a5c2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2bin.bin diff --git a/modules/m2sci/macros/sci_files/sci_dec2bin.sci b/modules/m2sci/macros/sci_files/sci_dec2bin.sci new file mode 100755 index 000000000..0ee30cfe9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2bin.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_dec2bin(tree) + // M2SCI function + // Conversion function for Matlab dec2bin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + proddims=1 + for k=tree.rhs(1).dims + proddims=k*proddims + end + tree.lhs(1).dims=list(proddims,1) + tree.lhs(1).type=Type(String,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_dec2hex.bin b/modules/m2sci/macros/sci_files/sci_dec2hex.bin Binary files differnew file mode 100755 index 000000000..7d4ce676a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2hex.bin diff --git a/modules/m2sci/macros/sci_files/sci_dec2hex.sci b/modules/m2sci/macros/sci_files/sci_dec2hex.sci new file mode 100755 index 000000000..d765d58c0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dec2hex.sci @@ -0,0 +1,64 @@ +// 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]=sci_dec2hex(tree) + // M2SCI function + // Conversion function for Matlab dec2hex() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // str=dec2hex(D) + if rhs==1 then + D=getrhs(tree) + D=convert2double(D) + + if ~is_real(D) then + newD=Funcall("real",1,list(D),list(D)) + repl_poss(newD,D,D,gettext("is Real.")); + D=newD + end + tree.rhs=list(D) + + if is_empty(D) then + tree=Cste("") + return + elseif not_empty(D) then + tree=Funcall("matrix",1,list(tree,Cste(-1),Cste(1)),tree.lhs) + if is_a_scalar(D) then + tree.lhs(1).dims=list(1,Unknown) + elseif is_a_vector(D) & ( D.dims(1)==1 | D.dims(2)>1 ) then // Row vector + tree.lhs(1).dims=list(D.dims(2),Unknown) + elseif is_a_vector(D) & ( D.dims(1)>1 | D.dims(2)==1 ) then + tree.lhs(1).dims=list(D.dims(1),Unknown) + else + tree.lhs(1).dims=list(Unknown,Unknown) + end + else + tree.name="mtlb_dec2hex" + tree.lhs(1).dims=list(Unknown,Unknown) + end + + // str=dec2hex(D,N) + else + [D,N]=getrhs(tree) + D=convert2double(D) + N=convert2double(N) + tree.rhs=list(D,N) + + tree.name="mtlb_dec2hex" + + if is_empty(D) then + tree=Cste("") + return + elseif not_empty(D) & typeof(N)=="cste" then + tree.lhs(1).dims=list(Unknown,N.value) + end + end + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_delete.bin b/modules/m2sci/macros/sci_files/sci_delete.bin Binary files differnew file mode 100755 index 000000000..0de216df2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_delete.bin diff --git a/modules/m2sci/macros/sci_files/sci_delete.sci b/modules/m2sci/macros/sci_files/sci_delete.sci new file mode 100755 index 000000000..87c679d56 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_delete.sci @@ -0,0 +1,24 @@ +// 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]=sci_delete(tree) + // M2SCI function + // Conversion function for Matlab delete() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + if X.vtype==String then + tree.name="mdelete" + elseif X.vtype<>Handle then + tree.name="mtlb_delete" + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_det.bin b/modules/m2sci/macros/sci_files/sci_det.bin Binary files differnew file mode 100755 index 000000000..1cf713654 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_det.bin diff --git a/modules/m2sci/macros/sci_files/sci_det.sci b/modules/m2sci/macros/sci_files/sci_det.sci new file mode 100755 index 000000000..fc1fa8a2a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_det.sci @@ -0,0 +1,24 @@ +// 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]=sci_det(tree) + // M2SCI function + // Conversion function for Matlab det() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + + // %c_det and %b_det are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=X.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diag.bin b/modules/m2sci/macros/sci_files/sci_diag.bin Binary files differnew file mode 100755 index 000000000..a8be8b14b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diag.bin diff --git a/modules/m2sci/macros/sci_files/sci_diag.sci b/modules/m2sci/macros/sci_files/sci_diag.sci new file mode 100755 index 000000000..76ee4bb88 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diag.sci @@ -0,0 +1,89 @@ +// 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]=sci_diag(tree) + // M2SCI function + // Conversion function for Matlab diag() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_diag() + + // B = diag(A,k) + if rhs==2 then + [A,k] = getrhs(tree) + // In Scilab k must be a real or complex matrix + k = convert2double(k) + tree.rhs=Rhs_tlist(A,k) + + // Compute dims to for inference + if typeof(k)=="cste" then + if A.dims(1)==1 then // diag of a row vector + n=A.dims(2)+k.value + m=n + elseif A.dims(2)==1 then // diag of a column vector + n=A.dims(1)+k.value + m=n + else + m=Unknown; + n=Unknown; + end + else + m=Unknown; + n=Unknown; + end + tree.lhs(1).dims=list(m,n) + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_diag" + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.rhs=Rhs_tlist(Funcall("bool2s",1,list(A),list()),k) + tree.lhs(1).type=Type(Boolean,Real) + else + tree.lhs(1).type=A.type + end + end + // B = diag(A) + else + A = getrhs(tree) + + // Compute dims to for inference + if A.dims(1)==1 then // diag of a row vector + n=A.dims(2) + m=n + elseif A.dims(2)==1 then // diag of a column vector + n=A.dims(1) + m=n + elseif not_a_vector(A) then + m=min(A.dims); + if not_empty(A) then + n=1 + else + n=Unknown; + end + else + m=Unknown; + n=Unknown; + end + tree.lhs(1).dims=list(m,n) + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_diag" + tree.lhs(1).type=A.type + else + if A.vtype==Boolean then + tree.rhs=Rhs_tlist(Funcall("bool2s",1,list(A),list())) + tree.lhs(1).type=Type(Boolean,Real) + else + tree.lhs(1).type=A.type + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diary.bin b/modules/m2sci/macros/sci_files/sci_diary.bin Binary files differnew file mode 100755 index 000000000..7b42b8a2f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diary.bin diff --git a/modules/m2sci/macros/sci_files/sci_diary.sci b/modules/m2sci/macros/sci_files/sci_diary.sci new file mode 100755 index 000000000..e3e9dc09a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diary.sci @@ -0,0 +1,34 @@ +// 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]=sci_diary(tree) + // M2SCI function + // Conversion function for Matlab diary() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // diary toggle + if rhs<=0 then + no_equiv("diary toggle") + else + str=getrhs(tree) + if typeof(str)=="variable" then + str=str.name + elseif typeof(str)=="cste" then + str=str.value + end + if convstr(str,"l")=="""off""" then // diary off + tree.rhs=Cste(0) + elseif convstr(str,"l")=="""on""" then // diary on + no_equiv("diary on") + else // diary(filename) + // Nothing to do + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_diff.bin b/modules/m2sci/macros/sci_files/sci_diff.bin Binary files differnew file mode 100755 index 000000000..8d89b4096 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diff.bin diff --git a/modules/m2sci/macros/sci_files/sci_diff.sci b/modules/m2sci/macros/sci_files/sci_diff.sci new file mode 100755 index 000000000..4c32c81f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_diff.sci @@ -0,0 +1,76 @@ +// 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]=sci_diff(tree) + // M2SCI function + // Conversion function for Matlab diff() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_diff() + + // Y = diff(X) + if rhs==1 then + X=getrhs(tree) + // %c_diff and %b_diff are not defined in Scilab + X=convert2double(X) + tree.rhs=Rhs_tlist(X) + + dim = first_non_singleton(X) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(X.dims) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(X,1,Funcall("firstnonsingleton",1,list(X),list())) + else + tree.lhs(1).dims=X.dims + if dim==0 then + tree.rhs=Rhs_tlist(X) + if is_a_scalar(X) then // Special case for scalar input, output is [] + tree.lhs(1).dims = list(0,0); + end + if is_a_vector(X) then // Special case for vector input (all dimensions known and one is greater than 1) + for n=1:size(X.dims) + if tree.lhs(1).dims(n)<>1 then + tree.lhs(1).dims(n)=tree.lhs(1).dims(n)-1; + end + end + end + else + tree.rhs=Rhs_tlist(X,1,dim) + tree.lhs(1).dims(dim)=max(X.dims(dim)-1,-1) + end + end + tree.lhs(1).type=Type(Double,Unknown) + // Y = diff(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree); + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + if ~is_a_vector(X) then + tree.name="mtlb_diff" + end + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + // Y = diff(X,n,dim) + else + [X,n,dim] = getrhs(tree); + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dir.bin b/modules/m2sci/macros/sci_files/sci_dir.bin Binary files differnew file mode 100755 index 000000000..9864cc93c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dir.bin diff --git a/modules/m2sci/macros/sci_files/sci_dir.sci b/modules/m2sci/macros/sci_files/sci_dir.sci new file mode 100755 index 000000000..96005537d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dir.sci @@ -0,0 +1,38 @@ +// 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]=sci_dir(tree) + // M2SCI function + // Conversion function for Matlab dir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_dir() + + if tree.lhs(1).name=="ans" then + tree.name="dir" + else + tree.name="mtlb_dir" + tree.lhs(1).type=Type(Struct,Real) + tree.lhs(1).dims=list(Unknown,1) + tree.lhs(1).contents=Contents() + + tree.lhs(1).contents.index(1)=list(list(Cste("*"),Cste("*")),Cste("name")) + tree.lhs(1).contents.data(1)=Infer(list(1,Unknown),Type(String,Real)) + + tree.lhs(1).contents.index(2)=list(list(Cste("*"),Cste("*")),Cste("date")) + tree.lhs(1).contents.data(2)=Infer(list(1,Unknown),Type(String,Real)) + + tree.lhs(1).contents.index(3)=list(list(Cste("*"),Cste("*")),Cste("bytes")) + tree.lhs(1).contents.data(3)=Infer(list(1,1),Type(Double,Real)) + + tree.lhs(1).contents.index(4)=list(list(Cste("*"),Cste("*")),Cste("isdir")) + tree.lhs(1).contents.data(4)=Infer(list(1,1),Type(Boolean,Real)) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_disp.bin b/modules/m2sci/macros/sci_files/sci_disp.bin Binary files differnew file mode 100755 index 000000000..5e7b836d8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_disp.bin diff --git a/modules/m2sci/macros/sci_files/sci_disp.sci b/modules/m2sci/macros/sci_files/sci_disp.sci new file mode 100755 index 000000000..87d1b153b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_disp.sci @@ -0,0 +1,16 @@ +// 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]=sci_disp(tree) + // M2SCI function + // Conversion function for Matlab disp() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_display.bin b/modules/m2sci/macros/sci_files/sci_display.bin Binary files differnew file mode 100755 index 000000000..642565858 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_display.bin diff --git a/modules/m2sci/macros/sci_files/sci_display.sci b/modules/m2sci/macros/sci_files/sci_display.sci new file mode 100755 index 000000000..2acae53ff --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_display.sci @@ -0,0 +1,19 @@ +// 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]=sci_display(tree) + // M2SCI function + // Conversion function for Matlab display() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + set_infos(gettext("Verify that overloading functions have been written for inputs in display()."),2); + tree.name="disp" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_doc.bin b/modules/m2sci/macros/sci_files/sci_doc.bin Binary files differnew file mode 100755 index 000000000..90556fac2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_doc.bin diff --git a/modules/m2sci/macros/sci_files/sci_doc.sci b/modules/m2sci/macros/sci_files/sci_doc.sci new file mode 100755 index 000000000..6d797f8fd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_doc.sci @@ -0,0 +1,30 @@ +// 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]=sci_doc(tree) + // M2SCI function + // Conversion function for Matlab doc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs=list() + else + topic=getrhs(tree) + k=strindex(topic.value,"/") + if k<>[] & min(k)<>2 then // help toolbox/ + no_equiv(expression2code(tree)); + elseif topic.value=="syntax" then + tree.rhs=Rhs_tlist("names") + else + // Nothing to do + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_docopt.bin b/modules/m2sci/macros/sci_files/sci_docopt.bin Binary files differnew file mode 100755 index 000000000..a473edb76 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_docopt.bin diff --git a/modules/m2sci/macros/sci_files/sci_docopt.sci b/modules/m2sci/macros/sci_files/sci_docopt.sci new file mode 100755 index 000000000..95c9eccd6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_docopt.sci @@ -0,0 +1,18 @@ +// 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]=sci_docopt(tree) + // M2SCI function + // Conversion function for Matlab docopt() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Variable("%browsehelp",Infer(list(1,Unknown),Type(String,Real))) + insert(Equal(list(),Funcall("global",1,list(Cste(tree.name)),list()))) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_dos.bin b/modules/m2sci/macros/sci_files/sci_dos.bin Binary files differnew file mode 100755 index 000000000..4a07d547f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dos.bin diff --git a/modules/m2sci/macros/sci_files/sci_dos.sci b/modules/m2sci/macros/sci_files/sci_dos.sci new file mode 100755 index 000000000..28cf889cb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_dos.sci @@ -0,0 +1,49 @@ +// 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]=sci_dos(tree) + // M2SCI function + // Conversion function for Matlab dos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if rhs==2 then + tree.rhs(2)=null() + end + + if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end + else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_double.bin b/modules/m2sci/macros/sci_files/sci_double.bin Binary files differnew file mode 100755 index 000000000..c14252717 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_double.bin diff --git a/modules/m2sci/macros/sci_files/sci_double.sci b/modules/m2sci/macros/sci_files/sci_double.sci new file mode 100755 index 000000000..6ac89b0fd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_double.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]=sci_double(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab double() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="double" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_drawnow.bin b/modules/m2sci/macros/sci_files/sci_drawnow.bin Binary files differnew file mode 100755 index 000000000..03cddbc7f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_drawnow.bin diff --git a/modules/m2sci/macros/sci_files/sci_drawnow.sci b/modules/m2sci/macros/sci_files/sci_drawnow.sci new file mode 100755 index 000000000..bd6fbb31e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_drawnow.sci @@ -0,0 +1,18 @@ +// 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]=sci_drawnow(tree) + // M2SCI function + // Conversion function for Matlab drawnow() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + set_infos(gettext("Drawing events are not queued in Scilab."),0); + tree=Funcall("%comment",1,list(Cste(tree.name)),list()) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_echo.bin b/modules/m2sci/macros/sci_files/sci_echo.bin Binary files differnew file mode 100755 index 000000000..e2cdadb02 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_echo.bin diff --git a/modules/m2sci/macros/sci_files/sci_echo.sci b/modules/m2sci/macros/sci_files/sci_echo.sci new file mode 100755 index 000000000..6a77a1a93 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_echo.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 [tree]=sci_echo(tree) + // M2SCI function + // Conversion function for Matlab echo() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_echo() + + // echo toggle + if rhs<=0 then + // mode(abs(mode()-1)) + tree.name="mode" + sub=Operation("-",list(tree,Cste(1)),list()) + abs_funcall=Funcall("abs",1,Rhs_tlist(sub),list()) + tree.rhs=Rhs_tlist(abs_funcall) + // echo on or echo off + elseif rhs==1 then + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="on" then + tree.name="mode" + tree.rhs=Rhs_tlist(1); + elseif tree.rhs(1).value=="off" then + tree.name="mode" + tree.rhs=Rhs_tlist(0); + else + no_equiv(expression2code(tree)) + end + else + tree.name="mtlb_echo" + end + // echo function on/off + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eig.bin b/modules/m2sci/macros/sci_files/sci_eig.bin Binary files differnew file mode 100755 index 000000000..838037fa4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eig.bin diff --git a/modules/m2sci/macros/sci_files/sci_eig.sci b/modules/m2sci/macros/sci_files/sci_eig.sci new file mode 100755 index 000000000..9313e70a6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eig.sci @@ -0,0 +1,102 @@ +// 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]=sci_eig(tree) + // M2SCI function + // Conversion function for Matlab eig() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // eig(A) + if rhs==1 then + // Because %c_spec and %b_spec are not defined + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.name="spec" + + // d = eig(A) + if lhs==1 then + tree.lhs(1).dims=list(A.dims(1),1) + tree.lhs(1).type=Type(Double,Unknown) + // [V,D] = eig(A) + else + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + // eig(A,B) or eig(A,'nobalance') + elseif rhs==2 then + [A,B] = getrhs(tree) + + // 'nobalance' + if B.vtype==String then + no_equiv(gettext("''nobalance'' option, IGNORED.")) + tree.rhs=Rhs_tlist(tree.rhs(1)) + if lhs==1 then + tree.name="spec" + tree.lhs(1).dims=list(A.dims(1),1) + tree.lhs(1).type=Type(Double,Unknown) + else + tree.rhs(1)=Operation("+",list(tree.rhs(1),Variable("%i",Infer()),list())) + rhs2=Operation("+",list(Cste(1),Variable("%eps",Infer()),list())) + tree.rhs=Rhs_tlist(tree.rhs(1),rhs2) + tree.name="bdiag" + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + return + end + + if B.vtype<>Double then + set_infos(gettext("eig() with 2 inputs: consider generalized eigen. Check."),2) + end + m=A.dims(1) + n=A.dims(2) + if lhs==1 then + al=gettempvar(1) + be=gettempvar(2) + insert(Equal(list(al,be),Funcall("spec",1,tree.rhs,list(al,be)))) + tree=Operation("./",list(al,be),tree.lhs) + + tree.out(1).dims=list(m,1) + tree.out(1).type=Type(Double,Unknown) + else + al=gettempvar(1) + be=gettempvar(2) + + insert(Equal(list(al,be,tree.lhs(1)),Funcall("eig",1,tree.rhs,list(al,be,tree.lhs(1))))) + + tree=Operation("./",list(al,be),list(tree.lhs(1))) + tree=Funcall("diag",1,list(tree),tree.out) + + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + // eig(A,B,flag) + else + no_equiv(msprintf(gettext("%s, flag IGNORED."),expression2code(tree))) + + tree.rhs(3)=null() + + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=Type(Double,Unknown) + if lhs==2 then + tree.lhs(2).dims=list(A.dims(1),A.dims(1)) + tree.lhs(2).type=Type(Double,Unknown) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eomday.bin b/modules/m2sci/macros/sci_files/sci_eomday.bin Binary files differnew file mode 100755 index 000000000..38a417e34 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eomday.bin diff --git a/modules/m2sci/macros/sci_files/sci_eomday.sci b/modules/m2sci/macros/sci_files/sci_eomday.sci new file mode 100755 index 000000000..5339ee0b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eomday.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_eomday(tree) + // M2SCI function + // Conversion function for Matlab eomday() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).type=Type(Double,Real) + tree.lhs(1).dims=list(1,1) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erf.bin b/modules/m2sci/macros/sci_files/sci_erf.bin Binary files differnew file mode 100755 index 000000000..b4ba986d7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erf.bin diff --git a/modules/m2sci/macros/sci_files/sci_erf.sci b/modules/m2sci/macros/sci_files/sci_erf.sci new file mode 100755 index 000000000..b68b00b8b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erf.sci @@ -0,0 +1,23 @@ +// 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]=sci_erf(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erf() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erfc.bin b/modules/m2sci/macros/sci_files/sci_erfc.bin Binary files differnew file mode 100755 index 000000000..5d57d7be1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfc.bin diff --git a/modules/m2sci/macros/sci_files/sci_erfc.sci b/modules/m2sci/macros/sci_files/sci_erfc.sci new file mode 100755 index 000000000..4723f563c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfc.sci @@ -0,0 +1,23 @@ +// 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]=sci_erfc(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erfc() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_erfcx.bin b/modules/m2sci/macros/sci_files/sci_erfcx.bin Binary files differnew file mode 100755 index 000000000..458edcee8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfcx.bin diff --git a/modules/m2sci/macros/sci_files/sci_erfcx.sci b/modules/m2sci/macros/sci_files/sci_erfcx.sci new file mode 100755 index 000000000..c3c1a184a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_erfcx.sci @@ -0,0 +1,23 @@ +// 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]=sci_erfcx(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab erfcx() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_error.bin b/modules/m2sci/macros/sci_files/sci_error.bin Binary files differnew file mode 100755 index 000000000..65f27b37a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_error.bin diff --git a/modules/m2sci/macros/sci_files/sci_error.sci b/modules/m2sci/macros/sci_files/sci_error.sci new file mode 100755 index 000000000..5961ccc31 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_error.sci @@ -0,0 +1,23 @@ +// 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]=sci_error(tree) + // M2SCI function + // Conversion function for Matlab error() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + //Scilab error is equivalent to the Matlab one + return + else + tree.name="mtlb_error" + return + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_etime.bin b/modules/m2sci/macros/sci_files/sci_etime.bin Binary files differnew file mode 100755 index 000000000..d5eeaf6b7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_etime.bin diff --git a/modules/m2sci/macros/sci_files/sci_etime.sci b/modules/m2sci/macros/sci_files/sci_etime.sci new file mode 100755 index 000000000..8007d1b13 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_etime.sci @@ -0,0 +1,18 @@ +// 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]=sci_etime(tree) + // M2SCI function + // Conversion function for Matlab etime + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eval.bin b/modules/m2sci/macros/sci_files/sci_eval.bin Binary files differnew file mode 100755 index 000000000..162c6ec5e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eval.bin diff --git a/modules/m2sci/macros/sci_files/sci_eval.sci b/modules/m2sci/macros/sci_files/sci_eval.sci new file mode 100755 index 000000000..48be1b5ec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eval.sci @@ -0,0 +1,41 @@ +// 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]=sci_eval(tree) + // M2SCI function + // Conversion function for Matlab eval() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_eval() + + if lhs==1 then + // eval(expression) + if rhs==1 then + tree.name="mtlb_eval" + // eval(expression,catch_expr) + else + tree.name="mtlb_eval" + end + else + tree.name="mtlb_eval" + + // lhs names + LHS=[] + for k=1:lhs + LHS=[LHS,tree.lhs(k).name] + end + LHS="["+strcat(LHS,",")+"]" + if typeof(tree.rhs(1))=="cste" then + tree.rhs=Rhs_tlist(LHS+" = "+tree.rhs(1).value) + else + tree.rhs=Rhs_tlist(LHS+" = "+expression2code(tree.rhs(1))) + end + tree.lhs=list(Variable("ans",Infer())) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exist.bin b/modules/m2sci/macros/sci_files/sci_exist.bin Binary files differnew file mode 100755 index 000000000..5e29f7c40 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exist.bin diff --git a/modules/m2sci/macros/sci_files/sci_exist.sci b/modules/m2sci/macros/sci_files/sci_exist.sci new file mode 100755 index 000000000..6e529b28b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exist.sci @@ -0,0 +1,26 @@ +// 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]=sci_exist(tree) + // M2SCI function + // Conversion function for Matlab exist() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_exist() + + no_equiv(gettext("Matlab exist(), mtlb_exist() is called.")) + + set_infos(gettext("mtlb_exist() is just a partial emulation of Matlab exist() function."),2) + + scitree.name="mtlb_exist" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exit.bin b/modules/m2sci/macros/sci_files/sci_exit.bin Binary files differnew file mode 100755 index 000000000..68ff64667 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exit.bin diff --git a/modules/m2sci/macros/sci_files/sci_exit.sci b/modules/m2sci/macros/sci_files/sci_exit.sci new file mode 100755 index 000000000..907241853 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exit.sci @@ -0,0 +1,16 @@ +// 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]=sci_exit(tree) + // M2SCI function + // Conversion function for Matlab exit + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_exp.bin b/modules/m2sci/macros/sci_files/sci_exp.bin Binary files differnew file mode 100755 index 000000000..5722fa2e6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exp.bin diff --git a/modules/m2sci/macros/sci_files/sci_exp.sci b/modules/m2sci/macros/sci_files/sci_exp.sci new file mode 100755 index 000000000..d3f42dc17 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_exp.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]=sci_exp(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab exp() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="exp" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_expm.bin b/modules/m2sci/macros/sci_files/sci_expm.bin Binary files differnew file mode 100755 index 000000000..6be2d7831 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_expm.bin diff --git a/modules/m2sci/macros/sci_files/sci_expm.sci b/modules/m2sci/macros/sci_files/sci_expm.sci new file mode 100755 index 000000000..ca247f433 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_expm.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]=sci_expm(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab expm() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="expm" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_eye.bin b/modules/m2sci/macros/sci_files/sci_eye.bin Binary files differnew file mode 100755 index 000000000..2e8ecbf41 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eye.bin diff --git a/modules/m2sci/macros/sci_files/sci_eye.sci b/modules/m2sci/macros/sci_files/sci_eye.sci new file mode 100755 index 000000000..8820a67f2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_eye.sci @@ -0,0 +1,176 @@ +// 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]=sci_eye(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab eye() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_eye() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // eye(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("eye",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // eye([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("eye",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // eye(n) or eye([n1,n2,...]) ? + else + tree.name="mtlb_eye" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // eye(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="eye" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_factor.bin b/modules/m2sci/macros/sci_files/sci_factor.bin Binary files differnew file mode 100755 index 000000000..dd844f299 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factor.bin diff --git a/modules/m2sci/macros/sci_files/sci_factor.sci b/modules/m2sci/macros/sci_files/sci_factor.sci new file mode 100755 index 000000000..3658c2116 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factor.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_factor(tree) + // M2SCI function + // Conversion function for Matlab factor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims(1)=1 + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_factorial.bin b/modules/m2sci/macros/sci_files/sci_factorial.bin Binary files differnew file mode 100755 index 000000000..8b7bce292 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factorial.bin diff --git a/modules/m2sci/macros/sci_files/sci_factorial.sci b/modules/m2sci/macros/sci_files/sci_factorial.sci new file mode 100755 index 000000000..1e6b3ca63 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_factorial.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_factorial(tree) + // M2SCI function + // Conversion function for Matlab factorial() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_false.bin b/modules/m2sci/macros/sci_files/sci_false.bin Binary files differnew file mode 100755 index 000000000..a8f3c7416 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_false.bin diff --git a/modules/m2sci/macros/sci_files/sci_false.sci b/modules/m2sci/macros/sci_files/sci_false.sci new file mode 100755 index 000000000..4e4f8ca3e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_false.sci @@ -0,0 +1,176 @@ +// 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]=sci_false(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab false() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_false() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // false(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("zeros",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // false([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("zeros",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // false(n) or false([n1,n2,...]) ? + else + tree.name="mtlb_false" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // false(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="zeros" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_fclose.bin b/modules/m2sci/macros/sci_files/sci_fclose.bin Binary files differnew file mode 100755 index 000000000..d79b267c5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fclose.bin diff --git a/modules/m2sci/macros/sci_files/sci_fclose.sci b/modules/m2sci/macros/sci_files/sci_fclose.sci new file mode 100755 index 000000000..015f46b24 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fclose.sci @@ -0,0 +1,27 @@ +// 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]=sci_fclose(tree) + // M2SCI function + // Conversion function for Matlab fclose() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + tree.name="mclose" + + if fid.vtype==Unknown then + set_infos(gettext("Unknown type for input parameter: consider fclose(fid)."),2) + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_feof.bin b/modules/m2sci/macros/sci_files/sci_feof.bin Binary files differnew file mode 100755 index 000000000..b2c4a43a1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feof.bin diff --git a/modules/m2sci/macros/sci_files/sci_feof.sci b/modules/m2sci/macros/sci_files/sci_feof.sci new file mode 100755 index 000000000..36ea9a985 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feof.sci @@ -0,0 +1,23 @@ +// 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]=sci_feof(tree) + // M2SCI function + // Conversion function for Matlab feof() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + tree.name="meof" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ferror.bin b/modules/m2sci/macros/sci_files/sci_ferror.bin Binary files differnew file mode 100755 index 000000000..cdbc03cf3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ferror.bin diff --git a/modules/m2sci/macros/sci_files/sci_ferror.sci b/modules/m2sci/macros/sci_files/sci_ferror.sci new file mode 100755 index 000000000..9f1b4d612 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ferror.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]=sci_ferror(tree) + // M2SCI function + // Conversion function for Matlab ferror() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + fid=getrhs(tree) + + // ferror(fid,'clear') + if rhs==2 then + tree.rhs(2)=null() + if lhs==2 then + no_equiv(msprintf(gettext("%s with two outputs."),expression2code(tree))); + else + tree.name="mclearerr" + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + end + // ferror(fid) + else + if lhs==2 then + no_equiv(msprintf(gettext("%s with two outputs."),expression2code(tree))); + else + tree.name="merror" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_feval.bin b/modules/m2sci/macros/sci_files/sci_feval.bin Binary files differnew file mode 100755 index 000000000..188ab826b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feval.bin diff --git a/modules/m2sci/macros/sci_files/sci_feval.sci b/modules/m2sci/macros/sci_files/sci_feval.sci new file mode 100755 index 000000000..93879664c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_feval.sci @@ -0,0 +1,51 @@ +// 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]=sci_feval(tree) + // M2SCI function + // Conversion function for Matlab feval() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_feval() + + set_infos(gettext("Verify that expression evaluated by execstr() is Scilab compatible."),2) + + RHS="(" + for k=2:rhs + if k<>2 then + RHS=RHS+"," + end + if typeof(tree.rhs(k))=="cste" then + RHS=RHS+string(tree.rhs(k).value) + else + RHS=RHS+rhs2code(tree.rhs(k)) + end + end + RHS=RHS+")" + RHS=Operation("+",list(tree.rhs(1),Cste(RHS)),list()) + + if lhs==1 then + tree.name="evstr" + tree.rhs=list(RHS) + else + tree.name="execstr" + LHS="[" + for k=1:lhs + if k>1 then + LHS=LHS+"," + end + LHS=LHS+tree.lhs(k).name + end + LHS=LHS+"]" + + tree.rhs=Rhs_tlist(Operation("+",list(Cste(LHS+" = "),RHS),list())) + + tree.lhs=list(Variable("ans",Infer())) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fft.bin b/modules/m2sci/macros/sci_files/sci_fft.bin Binary files differnew file mode 100755 index 000000000..45ad5d905 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft.bin diff --git a/modules/m2sci/macros/sci_files/sci_fft.sci b/modules/m2sci/macros/sci_files/sci_fft.sci new file mode 100755 index 000000000..e255c61b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft.sci @@ -0,0 +1,73 @@ +// 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]=sci_fft(tree) + // M2SCI function + // Conversion function for Matlab fft() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fft() + + // Y = fft(X) + if rhs==1 then + X = getrhs(tree) + // %c_fft and %b_fft are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X,-1) + + if size(X.dims)==2 then + if is_a_scalar(X) | is_a_vector(X) then + tree.rhs=Rhs_tlist(X,-1) + elseif not_a_vector(X) then + if X.dims(2)<>Unknown then + tree.rhs=Rhs_tlist(X,-1,X.dims(1),1) + else + tmp=Funcall("size",1,list(X,1),list()) + tree.rhs=Rhs_tlist(X,-1,tmp,1) + end + else + tree.name="mtlb_fft" + tree.rhs=Rhs_tlist(X) + end + else + tree.rhs=Rhs_tlist(X,-1,Funcall("firstnonsingleton",1,list(X,"num"),list()),1) + end + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = fft(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + tree.name="mtlb_fft" + if is_empty(X) + tree.lhs(1).dims=list(0,0) + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Unknown) + // Three input args + elseif rhs==3 then + [X,n,dim] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.name="mtlb_fft" + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fft2.bin b/modules/m2sci/macros/sci_files/sci_fft2.bin Binary files differnew file mode 100755 index 000000000..20929f9ef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft2.bin diff --git a/modules/m2sci/macros/sci_files/sci_fft2.sci b/modules/m2sci/macros/sci_files/sci_fft2.sci new file mode 100755 index 000000000..ef9cdd991 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fft2.sci @@ -0,0 +1,54 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_fft2(tree) + // M2SCI function + // Conversion function for Matlab fft2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Y = fft2(X) + if rhs == 1 then + X = getrhs(tree) + // %c_fft2 and %b_fft2 are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = fft2(X,m,n) + elseif rhs == 3 then + [X,m,n] = getrhs(tree) + X = convert2double(X) + m = convert2double(m) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,m,n) + + tree.lhs(1).type=Type(Double,Unknown) + + for i=1:size(X.dims) + if X.dims(i)==-1 then + tree.lhs(1).dims=allunknown(X.dims) + return + end + end + if tree.rhs(2).dims(1) <> -1 & tree.rhs(3).dims(1) <> -1 + tree.lhs(1).dims=list(m.value,n.value) + else + tree.lhs(1).dims=allunknown(X.dims) + return + end + // case x hypermatrix + for i=3:size(X.dims) + tree.lhs(1).dims($+1)=X.dims(i) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fftshift.bin b/modules/m2sci/macros/sci_files/sci_fftshift.bin Binary files differnew file mode 100755 index 000000000..76784007d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fftshift.bin diff --git a/modules/m2sci/macros/sci_files/sci_fftshift.sci b/modules/m2sci/macros/sci_files/sci_fftshift.sci new file mode 100755 index 000000000..1ee77f64b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fftshift.sci @@ -0,0 +1,30 @@ +// 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]=sci_fftshift(tree) + // M2SCI function + // Conversion function for Matlab fftshift() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.name="mtlb_fftshift" + end + if rhs==2 then + if typeof(tree.rhs(2))=="cste" then + if tree.rhs(2).value>size(tree.rhs(1).dims) then + tree.name="mtlb_fftshift" + end + else + tree.name="mtlb_fftshift" + end + end + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(tree.rhs(1).vtype,tree.rhs(1).property) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fgetl.bin b/modules/m2sci/macros/sci_files/sci_fgetl.bin Binary files differnew file mode 100755 index 000000000..c4e7decc5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgetl.bin diff --git a/modules/m2sci/macros/sci_files/sci_fgetl.sci b/modules/m2sci/macros/sci_files/sci_fgetl.sci new file mode 100755 index 000000000..96e8e40e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgetl.sci @@ -0,0 +1,45 @@ +// 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]=sci_fgetl(tree) + // M2SCI function + // Conversion function for Matlab fgetl() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mgetl" + tree.rhs(2)=Cste(1) + + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name=="ans" then + out=gettempvar() + insert(Equal(list(out),tree)) + tree=out + else + out=tree.lhs(1) + end + + // meof + meof_funcall=Funcall("meof",1,list(),list()) + // meof()~=0 + neq=Operation("~=",list(meof_funcall,Cste(0)),list()) + + // output=-1 + EQ=Equal(list(out),Cste(-1)) + + if typeof(tree)=="variable" then + insert(tlist(["ifthenelse","expression","then","elseifs","else"],neq,list(EQ),list(),list())); + else + insert(tlist(["ifthenelse","expression","then","elseifs","else"],neq,list(EQ),list(),list()),1); + end + + if typeof(tree)<>"variable" then + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(Unknown,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fgets.bin b/modules/m2sci/macros/sci_files/sci_fgets.bin Binary files differnew file mode 100755 index 000000000..26f2253ba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgets.bin diff --git a/modules/m2sci/macros/sci_files/sci_fgets.sci b/modules/m2sci/macros/sci_files/sci_fgets.sci new file mode 100755 index 000000000..1fe42dd30 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fgets.sci @@ -0,0 +1,56 @@ +// 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]=sci_fgets(tree) + // M2SCI function + // Conversion function for Matlab fgets() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + + if rhs==2 then + tree.name="mgetstr" + tree.rhs=Rhs_tlist(tree.rhs(2),tree.rhs(1)) + if typeof(tree.rhs(1))=="cste" then + tree.lhs(1).dims=list(1,tree.rhs(1).value) + else + tree.lhs(1).dims=list(1,Unknown) + end + tree.lhs(1).type=Type(String,Real) + else + tree.name="mgetl" + tree.lhs(1).dims=list(1,Unknown) + tree.rhs(2)=Cste(1) + // Add a case for the end of file + // fgets returns -1 + // mgetl returns [] + outputvar = tree.lhs(1); + tempvar = %F; + if typeof(outputvar)=="variable" & outputvar.name=="ans" then + outputvar = gettempvar(); + tempvar = %T; + end + // if isempty(outputvar) then outputvar=-1; end + isemptyfuncall = Funcall("isempty", 1, list(outputvar), list()); + newvalue = Equal(list(outputvar), Cste(-1)); + + // If the result is not assigned to a variable then a temporary variable is returned + if tempvar then + // Assign result to tmp + insert(Equal(list(outputvar), tree)); + // Just add the test for EOF + insert(tlist(["ifthenelse","expression","then","elseifs","else"],isemptyfuncall, list(newvalue),list(),list())); + tree = outputvar; + tree.type = Type(Unknown,Real); + else // Just add the test for EOF + insert(tlist(["ifthenelse","expression","then","elseifs","else"],isemptyfuncall, list(newvalue),list(),list()), 1); + tree.lhs(1).type=Type(Unknown,Real) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fileparts.bin b/modules/m2sci/macros/sci_files/sci_fileparts.bin Binary files differnew file mode 100755 index 000000000..4faba3027 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fileparts.bin diff --git a/modules/m2sci/macros/sci_files/sci_fileparts.sci b/modules/m2sci/macros/sci_files/sci_fileparts.sci new file mode 100755 index 000000000..d7742b01b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fileparts.sci @@ -0,0 +1,34 @@ +// 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]=sci_fileparts(tree) + // M2SCI function + // Conversion function for Matlab fileparts() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + for klhs=1:lhs + tree.lhs(k).dims=list(Unknown,Unknown) + tree.lhs(k).type=Type(String,Real) + end + + // Add trailing / or \ to path + pathconvert_funcall=Funcall("pathconvert",1,Rhs_tlist("/"),list()) + if lhs==1 then + tree=Operation("+",list(tree,pathconvert_funcall),tree.lhs) + else + add=Operation("+",list(tree.lhs(1),pathconvert_funcall),list()) + insert(Equal(list(tree.lhs(1)),add),1) + end + + if lhs==4 then + insert(Equal(list(tree.lhs(4)),Cste("")),1) + tree.lhs(4)=null() + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_filesep.bin b/modules/m2sci/macros/sci_files/sci_filesep.bin Binary files differnew file mode 100755 index 000000000..ecc298ffd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_filesep.bin diff --git a/modules/m2sci/macros/sci_files/sci_filesep.sci b/modules/m2sci/macros/sci_files/sci_filesep.sci new file mode 100755 index 000000000..5169f810e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_filesep.sci @@ -0,0 +1,18 @@ +// 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]=sci_filesep(tree) + // M2SCI function + // Conversion function for Matlab filesep() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_find.bin b/modules/m2sci/macros/sci_files/sci_find.bin Binary files differnew file mode 100755 index 000000000..7dee792aa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_find.bin diff --git a/modules/m2sci/macros/sci_files/sci_find.sci b/modules/m2sci/macros/sci_files/sci_find.sci new file mode 100755 index 000000000..b71ec1521 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_find.sci @@ -0,0 +1,84 @@ +// 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]=sci_find(tree) + // M2SCI function + // Conversion function for Matlab find() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_find() + + x = getrhs(tree) + + // Because %c_find is not defined + x = convert2double(x) + tree.rhs=Rhs_tlist(x) + + // k = find(x) + if lhs==1 then + if is_complex(x) then + x = Funcall("abs",1,list(x),list(Variable("",x.infer))) + elseif ~is_real(x) then + newx = Funcall("abs",1,list(x),list(Variable("",x.infer))) + repl_poss(newx,x,x,gettext("is Real.")); + x=newx + end + tree.rhs=Rhs_tlist(x) + + tree1=Operation("''",list(tree),tree.lhs) + tree2=Funcall("matrix",1,Rhs_tlist(tree,-1,1),tree.lhs) + + tree.lhs(1).type=Type(Double,Real) + + if x.dims(1)==1 then // Row vector + tree.lhs(1).dims=list(1,Unknown) + elseif x.dims(2)==1 then // Column vector + tree=tree1 + tree.out(1).dims=list(Unknown,1) + tree.out(1).type=Type(Double,Real) + elseif not_a_vector(x) then + tree=tree2 + tree.lhs(1).dims=list(Unknown,Unknown) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + end + // [i,j] = find(x) + elseif lhs==2 then + if is_complex(x) then + x = Funcall("abs",1,list(x),list(Variable("",x.infer))) + elseif ~is_real(x) then + newx = Funcall("abs",1,list(x),list(Variable("",x.infer))) + repl_poss(newx,x,x,gettext("is Real.")); + x=newx + end + tree.rhs=Rhs_tlist(x) + + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).type=Type(Double,Real) + if x.dims(1)==1 then // Row Vector + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(2).dims=list(1,Unknown) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(2).dims=list(Unknown,Unknown) + end + // [i,j,v] = find(x) + else + tree.name="mtlb_find" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).type=Type(Double,Real) + tree.lhs(3).type=Type(Unknown,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_findstr.bin b/modules/m2sci/macros/sci_files/sci_findstr.bin Binary files differnew file mode 100755 index 000000000..ec9a6e2c5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_findstr.bin diff --git a/modules/m2sci/macros/sci_files/sci_findstr.sci b/modules/m2sci/macros/sci_files/sci_findstr.sci new file mode 100755 index 000000000..5d7024333 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_findstr.sci @@ -0,0 +1,23 @@ +// 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]=sci_findstr(tree) + // M2SCI function + // Conversion function for Matlab findstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_findstr() + + set_infos(gettext("No equivalent for findstr() in Scilab so mtlb_findstr() is called."),0); + + tree.name="mtlb_findstr" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fix.bin b/modules/m2sci/macros/sci_files/sci_fix.bin Binary files differnew file mode 100755 index 000000000..b10a15169 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fix.bin diff --git a/modules/m2sci/macros/sci_files/sci_fix.sci b/modules/m2sci/macros/sci_files/sci_fix.sci new file mode 100755 index 000000000..3528577d4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fix.sci @@ -0,0 +1,27 @@ +// 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]=sci_fix(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab fix() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fliplr.bin b/modules/m2sci/macros/sci_files/sci_fliplr.bin Binary files differnew file mode 100755 index 000000000..402dc5318 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fliplr.bin diff --git a/modules/m2sci/macros/sci_files/sci_fliplr.sci b/modules/m2sci/macros/sci_files/sci_fliplr.sci new file mode 100755 index 000000000..224153202 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fliplr.sci @@ -0,0 +1,41 @@ +// 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]=sci_fliplr(tree) + // M2SCI function + // Conversion function for Matlab fliplr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fliplr() + + treedims=tree.rhs(1).dims + treetype=tree.rhs(1).type + + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.name="mtlb_fliplr" + tree.lhs(1).dims=treedims + tree.lhs(1).type=treetype + else + if typeof(tree.rhs(1))<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),tree.rhs(1))) + else + tmp=tree.rhs(1) + end + + ind1=Cste(":") + ind2=Operation(":",list(Cste("$"),Cste(-1),Cste(1)),list()) + + tree=Operation("ext",list(tmp,ind1,ind2),tree.lhs) + + tree.out(1).dims=treedims + tree.out(1).type=treetype + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_flipud.bin b/modules/m2sci/macros/sci_files/sci_flipud.bin Binary files differnew file mode 100755 index 000000000..72d1a667a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_flipud.bin diff --git a/modules/m2sci/macros/sci_files/sci_flipud.sci b/modules/m2sci/macros/sci_files/sci_flipud.sci new file mode 100755 index 000000000..ecb0e00b9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_flipud.sci @@ -0,0 +1,34 @@ +// 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]=sci_flipud(tree) + // M2SCI function + // Conversion function for Matlab flipud() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + treedims=tree.rhs(1).dims + treetype=tree.rhs(1).type + + + if typeof(tree.rhs(1))<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),tree.rhs(1))) + else + tmp=tree.rhs(1) + end + + ind1=Operation(":",list(Cste("$"),Cste(-1),Cste(1)),list()) + ind2=Cste(":") + + tree=Operation("ext",list(tmp,ind1,ind2),tree.lhs) + + tree.out(1).dims=treedims + tree.out(1).type=treetype +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_floor.bin b/modules/m2sci/macros/sci_files/sci_floor.bin Binary files differnew file mode 100755 index 000000000..efe931b7f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_floor.bin diff --git a/modules/m2sci/macros/sci_files/sci_floor.sci b/modules/m2sci/macros/sci_files/sci_floor.sci new file mode 100755 index 000000000..6a5a9fc24 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_floor.sci @@ -0,0 +1,27 @@ +// 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]=sci_floor(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab floor() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fopen.bin b/modules/m2sci/macros/sci_files/sci_fopen.bin Binary files differnew file mode 100755 index 000000000..2b7d88649 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fopen.bin diff --git a/modules/m2sci/macros/sci_files/sci_fopen.sci b/modules/m2sci/macros/sci_files/sci_fopen.sci new file mode 100755 index 000000000..acdfc6a41 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fopen.sci @@ -0,0 +1,61 @@ +// 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]=sci_fopen(tree) + // M2SCI function + // Conversion function for Matlab fopen() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + filename=getrhs(tree) + permission="rb" + elseif rhs==2 then + [filename,permission]=getrhs(tree) + elseif rhs==3 then + [filename,permission,machineformat]=getrhs(tree) + no_equiv(expression2code(tree)) + return + end + + if typeof(filename)=="cste" then + if filename.value=="all" then + no_equiv(gettext("fopen(''all'') has no translation.")) + return + end + elseif filename.vtype==Double then + no_equiv(msprintf(gettext("%s (See fileinfo() function)."),expression2code(tree))) + return + end + + // Options 'W' and 'A' are unknown for Scilab + if typeof(permission)=="cste" then + if or(permission.value==["W","A"]) then + no_equiv(gettext("W and A permission parameters.")); + return + end + end + + tree.name="mtlb_fopen" + + // fid=fopen(filename) and so on + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + // [fid,mess]=fopen(filename) and so on + elseif lhs==2 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,Unknown) + tree.lhs(2).type=Type(String,Real) + // [fid,mess,machineformat]=fopen(filename) and so on + else + no_equiv(gettext("fopen used with three outputs.")) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_format.bin b/modules/m2sci/macros/sci_files/sci_format.bin Binary files differnew file mode 100755 index 000000000..2c2c8488f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_format.bin diff --git a/modules/m2sci/macros/sci_files/sci_format.sci b/modules/m2sci/macros/sci_files/sci_format.sci new file mode 100755 index 000000000..6c46d2956 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_format.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]=sci_format(tree) + // M2SCI function + // Conversion function for Matlab format + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_format() + + rhs1=rhs + if rhs==2 then + fp="e" + rhs=rhs-1 + else + fp="v" + end + + d=5; + hex=%f; + bank=%f; + compact=%f; + loose=%f, + ratf=%f; + symb=%f; + unk=%f + + if rhs==1 then + f=tree.rhs(1) + select f.value + case """short""" then + d=5 + case """long""" then + d=15 + case """hex""" then + hex=%t + case """+""" then + symb=%t + case """bank""" then + bank=%t + case """compact""" then + compact=%t + case """loose""" then + loose=%t + case """rat""" then + ratf=%t + else + unk=%t + end + else + d=5 + end + + + if unk then + if rhs1==1 then + tree.name="mtlb_format" + else + tree.name="mtlb_format" + end + elseif ratf|loose|compact|bank|hex then + no_equiv("format "+f.value) + else + if rhs1==1 then + tree.rhs=Rhs_tlist(d+1) + elseif rhs1==2 then + tree.rhs=Rhs_tlist(fp,d+1) + else + tree.rhs=Rhs_tlist("v",6) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fprintf.bin b/modules/m2sci/macros/sci_files/sci_fprintf.bin Binary files differnew file mode 100755 index 000000000..ddd7bf28c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fprintf.bin diff --git a/modules/m2sci/macros/sci_files/sci_fprintf.sci b/modules/m2sci/macros/sci_files/sci_fprintf.sci new file mode 100755 index 000000000..b21023d89 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fprintf.sci @@ -0,0 +1,23 @@ +// 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]=sci_fprintf(tree) + // M2SCI function + // Conversion function for Matlab fprintf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fprintf() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fprintf"),0); + + tree.name="mtlb_fprintf" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fread.bin b/modules/m2sci/macros/sci_files/sci_fread.bin Binary files differnew file mode 100755 index 000000000..dd7e3d6ee --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fread.bin diff --git a/modules/m2sci/macros/sci_files/sci_fread.sci b/modules/m2sci/macros/sci_files/sci_fread.sci new file mode 100755 index 000000000..c19f11ab7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fread.sci @@ -0,0 +1,36 @@ +// 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]=sci_fread(tree) + // M2SCI function + // Conversion function for Matlab fread() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fread() + + RHS=[] + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fread"),0); + + if rhs==4 then + no_equiv(msprintf(gettext("%s() called with skip parameter."),"fread")); + end + + tree.name="mtlb_fread" + + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_frewind.bin b/modules/m2sci/macros/sci_files/sci_frewind.bin Binary files differnew file mode 100755 index 000000000..44491b04f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_frewind.bin diff --git a/modules/m2sci/macros/sci_files/sci_frewind.sci b/modules/m2sci/macros/sci_files/sci_frewind.sci new file mode 100755 index 000000000..474ed8a16 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_frewind.sci @@ -0,0 +1,19 @@ +// 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]=sci_frewind(tree) + // M2SCI function + // Conversion function for Matlab frewind() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mseek" + tree.rhs=Rhs_tlist(0,tree.rhs(1)) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fscanf.bin b/modules/m2sci/macros/sci_files/sci_fscanf.bin Binary files differnew file mode 100755 index 000000000..2faf65f01 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fscanf.bin diff --git a/modules/m2sci/macros/sci_files/sci_fscanf.sci b/modules/m2sci/macros/sci_files/sci_fscanf.sci new file mode 100755 index 000000000..afa8bb0a7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fscanf.sci @@ -0,0 +1,32 @@ +// 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]=sci_fscanf(tree) + // M2SCI function + // Conversion function for Matlab fscanf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fscanf() + + RHS=[] + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fscanf"),0); + + tree.name="mtlb_fscanf" + + if lhs==1 then + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fseek.bin b/modules/m2sci/macros/sci_files/sci_fseek.bin Binary files differnew file mode 100755 index 000000000..ee1b849ab --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fseek.bin diff --git a/modules/m2sci/macros/sci_files/sci_fseek.sci b/modules/m2sci/macros/sci_files/sci_fseek.sci new file mode 100755 index 000000000..477713184 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fseek.sci @@ -0,0 +1,55 @@ +// 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]=sci_fseek(tree) + // M2SCI function + // Conversion function for Matlab fseek() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [fid,offset,origin]=getrhs(tree) + + if typeof(origin)=="cste" then + select origin.value + case "bof" then + flag="set" + case "cof" then + flag="cur" + case "eof" then + flag="end" + case -1 then + flag="set" // Should not happen because -1 is an operation... + case 0 then + flag="cur" + case 1 then + flag="end" + else + set_infos(msprintf(gettext("Not enough information on %s to set the proper flag."),expression2code(origin)),1) + flag=Funcall("fseek_origin",1,list(origin),list()) + end + else + if typeof(origin)=="operation" then + if origin.operator=="-" then + if origin.operands==list(Cste(1)) then + flag="set" + end + end + else + set_infos(msprintf(gettext("Not enough information on %s to set the proper flag."),expression2code(origin)),1) + flag=Funcall("fseek_origin",1,list(origin),list()) + end + end + + tree.name="mseek" + tree.rhs=Rhs_tlist(offset,fid,flag) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ftell.bin b/modules/m2sci/macros/sci_files/sci_ftell.bin Binary files differnew file mode 100755 index 000000000..e0e9f7639 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ftell.bin diff --git a/modules/m2sci/macros/sci_files/sci_ftell.sci b/modules/m2sci/macros/sci_files/sci_ftell.sci new file mode 100755 index 000000000..33b5cfd6a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ftell.sci @@ -0,0 +1,21 @@ +// 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]=sci_ftell(tree) + // M2SCI function + // Conversion function for Matlab ftell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="mtell" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_full.bin b/modules/m2sci/macros/sci_files/sci_full.bin Binary files differnew file mode 100755 index 000000000..f8de6a7ca --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_full.bin diff --git a/modules/m2sci/macros/sci_files/sci_full.sci b/modules/m2sci/macros/sci_files/sci_full.sci new file mode 100755 index 000000000..51257ca54 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_full.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]=sci_full(tree) + // M2SCI function + // Conversion function for Matlab full() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_full() + + S = getrhs(tree) + + if S.vtype==String then + tree.name="mtlb_full" + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + elseif S.vtype==Boolean then + S = convert2double(S) + tree.rhs=Rhs_tlist(S) + tree.lhs(1).dims=S.dims + tree.lhs(1).type=Type(Boolean,Real) + elseif S.vtype==Double then + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + elseif S.vtype==Sparse then + tree.lhs(1).dims=S.dims + tree.lhs(1).type=Type(Double,S.property) + else + tree.name="mtlb_full" + tree.lhs(1).dims=S.dims + tree.lhs(1).type=S.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fullfile.bin b/modules/m2sci/macros/sci_files/sci_fullfile.bin Binary files differnew file mode 100755 index 000000000..787dd7aba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fullfile.bin diff --git a/modules/m2sci/macros/sci_files/sci_fullfile.sci b/modules/m2sci/macros/sci_files/sci_fullfile.sci new file mode 100755 index 000000000..9293bd35b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fullfile.sci @@ -0,0 +1,19 @@ +// 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]=sci_fullfile(tree) + // M2SCI function + // Conversion function for Matlab fullfile() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_fwrite.bin b/modules/m2sci/macros/sci_files/sci_fwrite.bin Binary files differnew file mode 100755 index 000000000..d20e868f2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fwrite.bin diff --git a/modules/m2sci/macros/sci_files/sci_fwrite.sci b/modules/m2sci/macros/sci_files/sci_fwrite.sci new file mode 100755 index 000000000..7e2632cde --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_fwrite.sci @@ -0,0 +1,27 @@ +// 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]=sci_fwrite(tree) + // M2SCI function + // Conversion function for Matlab fwrite() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_fwrite() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_fwrite"),0); + + if rhs==4 then + no_equiv(msprintf(gettext("%s() called with skip parameter."),"fwrite")); + end + + tree.name="mtlb_fwrite" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_gamma.bin b/modules/m2sci/macros/sci_files/sci_gamma.bin Binary files differnew file mode 100755 index 000000000..5d3c270b1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gamma.bin diff --git a/modules/m2sci/macros/sci_files/sci_gamma.sci b/modules/m2sci/macros/sci_files/sci_gamma.sci new file mode 100755 index 000000000..ef7bdb036 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gamma.sci @@ -0,0 +1,23 @@ +// 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]=sci_gamma(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab gamma() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_gammaln.bin b/modules/m2sci/macros/sci_files/sci_gammaln.bin Binary files differnew file mode 100755 index 000000000..40406e58b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gammaln.bin diff --git a/modules/m2sci/macros/sci_files/sci_gammaln.sci b/modules/m2sci/macros/sci_files/sci_gammaln.sci new file mode 100755 index 000000000..cbe27a5b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_gammaln.sci @@ -0,0 +1,23 @@ +// 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]=sci_gammaln(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab gammaln() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_getenv.bin b/modules/m2sci/macros/sci_files/sci_getenv.bin Binary files differnew file mode 100755 index 000000000..554777afb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_getenv.bin diff --git a/modules/m2sci/macros/sci_files/sci_getenv.sci b/modules/m2sci/macros/sci_files/sci_getenv.sci new file mode 100755 index 000000000..770c979d1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_getenv.sci @@ -0,0 +1,18 @@ +// 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]=sci_getenv(tree) + // M2SCI function + // Conversion function for Matlab getenv() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_global.bin b/modules/m2sci/macros/sci_files/sci_global.bin Binary files differnew file mode 100755 index 000000000..3a408fb2b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_global.bin diff --git a/modules/m2sci/macros/sci_files/sci_global.sci b/modules/m2sci/macros/sci_files/sci_global.sci new file mode 100755 index 000000000..07e737394 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_global.sci @@ -0,0 +1,36 @@ +// 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]=sci_global(tree) + // M2SCI function + // Conversion function for Matlab global() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Global variable for M2SCI + global("varslist"); + + for k=1:rhs + nam=tree.rhs(k).value + if nam<>"" then + exist=%F + for l=1:size(varslist) + if varslist(l).matname==nam then + exist=%T + break + end + end + if exist==%F then + varslist($+1)=M2scivar(nam,nam,Infer(list(Unknown,Unknown),Type(Unknown,Unknown))) + write(%io(2),msprintf(gettext("Global variable %s added to M2SCI variable list."),nam)) + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_graymon.bin b/modules/m2sci/macros/sci_files/sci_graymon.bin Binary files differnew file mode 100755 index 000000000..9e71372b9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_graymon.bin diff --git a/modules/m2sci/macros/sci_files/sci_graymon.sci b/modules/m2sci/macros/sci_files/sci_graymon.sci new file mode 100755 index 000000000..9fc51f47c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_graymon.sci @@ -0,0 +1,29 @@ +// 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]=sci_graymon(tree) + // M2SCI function + // Conversion function for Matlab graymon() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // set(gdf(),"color_map",[.75 .5 .25]'*ones(1,3)) + + tree.name="set" + + rc=Operation("rc",list(Cste(0.75),Cste(0.5)),list()); + rc=Operation("rc",list(rc,Cste(0.25)),list()); + transp=Operation("''",list(rc),list()) + ones_funcall=Funcall("ones",1,Rhs_tlist(1,3),list()) + mult=Operation("*",list(transp,ones_funcall),list()) + + gdf_funcall=Funcall("gdf",1,list(),list()) + + tree.rhs=Rhs_tlist(gdf_funcall,"color_map",mult); +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_grid.bin b/modules/m2sci/macros/sci_files/sci_grid.bin Binary files differnew file mode 100755 index 000000000..63f772fcc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_grid.bin diff --git a/modules/m2sci/macros/sci_files/sci_grid.sci b/modules/m2sci/macros/sci_files/sci_grid.sci new file mode 100755 index 000000000..3bae2bf9f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_grid.sci @@ -0,0 +1,58 @@ +// 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]=sci_grid(tree) + // M2SCI function + // Conversion function for Matlab grid() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_grid() + + // [1 1] + on=Operation("rc",list(Cste(1),Cste(1)),list()) + // [-1 -1] + off=Operation("rc",list(Cste(-1),Cste(-1)),list()) + if rhs==0 then // grid toggle + tree.name="mtlb_grid"; + elseif rhs==1 then + ax=Funcall("gca",1,list(),list()) + opt=tree.rhs(1) + if typeof(opt)=="cste" then + if opt.value=="on" then + tree.name="set"; + tree.rhs=Rhs_tlist(ax,"grid",on); + elseif opt.value=="off" then + tree.name="set"; + tree.rhs=Rhs_tlist(ax,"grid",off); + else + set_infos(gettext("No minor grid in Scilab."),2); + tree.name="mtlb_grid"; + end + else + tree.name="mtlb_grid"; + end + else + ax=tree.rhs(1) + opt=tree.rhs(2) + if typeof(opt)=="cste" then + if opt.value=="on" then + insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),on)) + tree=list() + elseif opt.value=="off" then + insert(Equal(list(Operation("ins",list(ax,Cste("grid")),list())),off)) + tree=list() + else + set_infos(gettext("No minor grid in Scilab."),2); + tree.name="mtlb_grid"; + end + else + tree.name="mtlb_grid"; + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hankel.bin b/modules/m2sci/macros/sci_files/sci_hankel.bin Binary files differnew file mode 100755 index 000000000..3e578c689 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hankel.bin diff --git a/modules/m2sci/macros/sci_files/sci_hankel.sci b/modules/m2sci/macros/sci_files/sci_hankel.sci new file mode 100755 index 000000000..11b6c204d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hankel.sci @@ -0,0 +1,106 @@ +// 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]=sci_hankel(tree) + // M2SCI function + // Conversion function for Matlab hankel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="hank" + + // H = hankel(c) + if rhs==1 then + if typeof(tree.rhs(1))<>"variable" then + c=gettempvar(); + insert(Equal(list(c),tree.rhs(1))) + else + c=tree.rhs(1); + end + + n=gettempvar() + insert(Equal(list(n),Funcall("size",1,Rhs_tlist(c,"*"),list()))); + + if is_a_scalar(tree.rhs(1)) then + v=c + else + // v=[matrix(c,1,-1),zeros(1,n)] + matrix_funcall=Funcall("matrix",1,Rhs_tlist(c,1,-1),list()) + zeros_funcall=Funcall("zeros",1,Rhs_tlist(1,n),list()) + v=Operation("rc",list(matrix_funcall,zeros_funcall),list()) + end + + dim=1 + for kd=1:lstsize(tree.rhs(1).dims) + if tree.rhs(1).dims(kd)<>Unknown then + dim=dim*tree.rhs(1).dims(kd) + else + dim=Unknown + break + end + end + + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=tree.rhs(1).type + + tree.rhs=Rhs_tlist(n,n,v); + // H = hankel(c,r) + else + if typeof(tree.rhs(1))<>"variable" then + c=gettempvar(); + insert(Equal(list(c),tree.rhs(1))) + else + c=tree.rhs(1); + end + + if typeof(tree.rhs(2))<>"variable" then + r=gettempvar(); + insert(Equal(list(r),tree.rhs(2))) + else + r=tree.rhs(2); + end + + m=gettempvar(); + n=gettempvar(); + insert(Equal(list(m),Funcall("size",1,Rhs_tlist(c,"*"),list()))); + insert(Equal(list(n),Funcall("size",1,Rhs_tlist(r,"*"),list()))); + + + // v=[matrix(c,1,-1),matrix(r(2:$),1,-1)] + cmatrix_funcall=Funcall("matrix",1,Rhs_tlist(c,1,-1),list()) + imp=Operation(":",list(Cste(2),Cste("$")),list()) + ext=Operation("ext",list(r,imp),list()) + rmatrix_funcall=Funcall("matrix",1,Rhs_tlist(ext,1,-1),list()) + v=Operation("rc",list(cmatrix_funcall,rmatrix_funcall),list()) + + dim1=1 + for kd=1:lstsize(tree.rhs(1).dims) + if tree.rhs(1).dims(kd)<>Unknown then + dim1=dim1*tree.rhs(1).dims(kd) + else + dim1=Unknown + break + end + end + dim2=1 + for kd=1:lstsize(tree.rhs(2).dims) + if tree.rhs(2).dims(kd)<>Unknown then + dim2=dim2*tree.rhs(2).dims(kd) + else + dim2=Unknown + break + end + end + + tree.lhs(1).dims=list(dim1,dim2) + tree.lhs(1).type=tree.rhs(1).type + + tree.rhs=Rhs_tlist(m,n,v); + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_help.bin b/modules/m2sci/macros/sci_files/sci_help.bin Binary files differnew file mode 100755 index 000000000..17eca8016 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_help.bin diff --git a/modules/m2sci/macros/sci_files/sci_help.sci b/modules/m2sci/macros/sci_files/sci_help.sci new file mode 100755 index 000000000..07cfb1188 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_help.sci @@ -0,0 +1,36 @@ +// 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]=sci_help(tree) +// M2SCI function +// Conversion function for Matlab help() +// Input: tree = Matlab funcall tree +// Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs=list() + else + topic=getrhs(tree) + + if typeof(topic) == "funcall" then + tree.rhs=Rhs_tlist(topic.name) + else + k=strindex(topic.value,"/") + + if k<>[] & min(k)<>2 then // help toolbox/ + no_equiv(expression2code(tree)); + elseif topic.value=="syntax" then + tree.rhs=Rhs_tlist("names") + else +// Nothing to do + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpbrowser.bin b/modules/m2sci/macros/sci_files/sci_helpbrowser.bin Binary files differnew file mode 100755 index 000000000..c82691733 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpbrowser.bin diff --git a/modules/m2sci/macros/sci_files/sci_helpbrowser.sci b/modules/m2sci/macros/sci_files/sci_helpbrowser.sci new file mode 100755 index 000000000..34fe96570 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpbrowser.sci @@ -0,0 +1,18 @@ +// 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]=sci_helpbrowser(tree) + // M2SCI function + // Conversion function for Matlab helpbrowser() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpdesk.bin b/modules/m2sci/macros/sci_files/sci_helpdesk.bin Binary files differnew file mode 100755 index 000000000..d751ccce2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpdesk.bin diff --git a/modules/m2sci/macros/sci_files/sci_helpdesk.sci b/modules/m2sci/macros/sci_files/sci_helpdesk.sci new file mode 100755 index 000000000..4ab6356bc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpdesk.sci @@ -0,0 +1,18 @@ +// 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]=sci_helpdesk(tree) + // M2SCI function + // Conversion function for Matlab helpdesk() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_helpwin.bin b/modules/m2sci/macros/sci_files/sci_helpwin.bin Binary files differnew file mode 100755 index 000000000..36414fa67 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpwin.bin diff --git a/modules/m2sci/macros/sci_files/sci_helpwin.sci b/modules/m2sci/macros/sci_files/sci_helpwin.sci new file mode 100755 index 000000000..9b9b5cba8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_helpwin.sci @@ -0,0 +1,18 @@ +// 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]=sci_helpwin(tree) + // M2SCI function + // Conversion function for Matlab helpwin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="help" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hess.bin b/modules/m2sci/macros/sci_files/sci_hess.bin Binary files differnew file mode 100755 index 000000000..3e105e505 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hess.bin diff --git a/modules/m2sci/macros/sci_files/sci_hess.sci b/modules/m2sci/macros/sci_files/sci_hess.sci new file mode 100755 index 000000000..5abcc66a6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hess.sci @@ -0,0 +1,32 @@ +// 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]=sci_hess(tree) + // M2SCI function + // Conversion function for Matlab hess() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // H = hess(A) + if lhs==1 then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + // [P,H] = hess(A) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(A.vtype,Unknown) // Real if A<>%i + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_hold.bin b/modules/m2sci/macros/sci_files/sci_hold.bin Binary files differnew file mode 100755 index 000000000..479b4e9d0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hold.bin diff --git a/modules/m2sci/macros/sci_files/sci_hold.sci b/modules/m2sci/macros/sci_files/sci_hold.sci new file mode 100755 index 000000000..1f6620aef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_hold.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]=sci_hold(tree) + // M2SCI function + // Conversion function for Matlab hold() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_hold() + + if rhs==0 then // hold toggle + tree.name="mtlb_hold" + else + opt=tree.rhs(1) + if typeof(opt)=="cste" then + if opt.value=="on" then + // set(gca(),'auto_clear','off') + gca_funcall=Funcall("gca",1,list(),list()) + tree.name="set" + tree.rhs=Rhs_tlist(gca_funcall,Cste("auto_clear"),Cste("off")) + elseif opt.value=="off" then + // set(gca(),'auto_clear','on') + gca_funcall=Funcall("gca",1,list(),list()) + tree.name="set" + tree.rhs=Rhs_tlist(gca_funcall,Cste("auto_clear"),Cste("on")) + else + no_equiv(msprintf(gettext("%s option."),opt.value)) + end + else + tree.name="mtlb_hold" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_home.bin b/modules/m2sci/macros/sci_files/sci_home.bin Binary files differnew file mode 100755 index 000000000..43e0775ba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_home.bin diff --git a/modules/m2sci/macros/sci_files/sci_home.sci b/modules/m2sci/macros/sci_files/sci_home.sci new file mode 100755 index 000000000..0de6a331b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_home.sci @@ -0,0 +1,18 @@ +// 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]=sci_home(tree) + // M2SCI function + // Conversion function for Matlab home + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="tohome" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_horzcat.bin b/modules/m2sci/macros/sci_files/sci_horzcat.bin Binary files differnew file mode 100755 index 000000000..ba84ed905 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_horzcat.bin diff --git a/modules/m2sci/macros/sci_files/sci_horzcat.sci b/modules/m2sci/macros/sci_files/sci_horzcat.sci new file mode 100755 index 000000000..7d526de39 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_horzcat.sci @@ -0,0 +1,72 @@ +// 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]=sci_horzcat(tree) + // M2SCI function + // Conversion function for Matlab horzcat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + allargs=tree.rhs + out=tree.lhs + + op="rc" + for k=1:lstsize(allargs) + if allargs(k).vtype==String then + op="+" + break + end + end + + tree=Operation(op,list(allargs(1),allargs(2)),list()) + + // Create output + for k=3:rhs + tree=Operation(op,list(tree,allargs(k)),list()) + end + tree.out=out + + // Dimensions + outdims=allargs(1).dims + for k=1:lstsize(outdims) + outdims(k)=Unknown + end + for k=1:rhs + for l=1:lstsize(allargs(k).dims) + if l<>2 & allargs(k).dims(l)<>Unknown then + outdims(l)=allargs(k).dims(l) + end + end + end + nbcols=0 + for k=1:rhs + if allargs(k).dims(2)<>Unknown then + nbcols=nbcols+allargs(k).dims(2) + else + nbcols=Unknown + break + end + end + outdims(2)=nbcols + + // Property + prop=Real + for k=1:rhs + if allargs(k).property==Complex then + prop=Complex + break + elseif allargs(k).property==Unknown then + prop=Unknown + break + end + end + + tree.out(1).dims=outdims + tree.out(1).type=Type(allargs(1).vtype,prop) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ifft.bin b/modules/m2sci/macros/sci_files/sci_ifft.bin Binary files differnew file mode 100755 index 000000000..967396d86 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ifft.bin diff --git a/modules/m2sci/macros/sci_files/sci_ifft.sci b/modules/m2sci/macros/sci_files/sci_ifft.sci new file mode 100755 index 000000000..6ff5d1713 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ifft.sci @@ -0,0 +1,77 @@ +// 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]=sci_ifft(tree) + // M2SCI function + // Conversion function for Matlab ifft() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_ifft() + + tree.name="fft" + + // Y = ifft(X) + if rhs==1 then + X = getrhs(tree) + // %c_ifft and %b_ifft are not defined + X = convert2double(X) + tree.rhs=Rhs_tlist(X,1) + + if size(X.dims)==2 then + if is_a_scalar(X) | is_a_vector(X) then + tree.rhs=Rhs_tlist(X,1) + elseif not_a_vector(X) then + if X.dims(2)<>Unknown then + tree.rhs=Rhs_tlist(X,1,X.dims(1),1) + else + tmp=Funcall("size",1,list(X,1),list()) + tree.rhs=Rhs_tlist(X,1,tmp,1) + end + else + tree.name="mtlb_ifft" + tree.rhs=Rhs_tlist(X) + end + else + tree.rhs=Rhs_tlist(X,1,Funcall("firstnonsingleton",1,list(X,"num"),list()),1) + end + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Unknown) + + // Y = ifft(X,n) + elseif rhs==2 then + [X,n] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + tree.rhs=Rhs_tlist(X,n) + + tree.name="mtlb_ifft" + + if is_empty(X) + tree.lhs(1).dims=list(0,0) + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Unknown) + + // Three input args + elseif rhs==3 then + [X,n,dim] = getrhs(tree) + X = convert2double(X) + n = convert2double(n) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(X,n,dim) + + tree.name="mtlb_ifft" + + tree.lhs(1).dims=allunknown(X.dims) + tree.lhs(1).type=Type(Double,Unknown) + + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_imag.bin b/modules/m2sci/macros/sci_files/sci_imag.bin Binary files differnew file mode 100755 index 000000000..a4283c073 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_imag.bin diff --git a/modules/m2sci/macros/sci_files/sci_imag.sci b/modules/m2sci/macros/sci_files/sci_imag.sci new file mode 100755 index 000000000..62b895a2d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_imag.sci @@ -0,0 +1,23 @@ +// 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]=sci_imag(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab imag() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_input.bin b/modules/m2sci/macros/sci_files/sci_input.bin Binary files differnew file mode 100755 index 000000000..fee8ca217 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_input.bin diff --git a/modules/m2sci/macros/sci_files/sci_input.sci b/modules/m2sci/macros/sci_files/sci_input.sci new file mode 100755 index 000000000..fdd74fd7a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_input.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]=sci_input(tree) + // M2SCI function + // Conversion function for Matlab input() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // input(msg) + if rhs==1 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + else + // input(msg,'s') + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int16.bin b/modules/m2sci/macros/sci_files/sci_int16.bin Binary files differnew file mode 100755 index 000000000..f04ad7e26 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int16.bin diff --git a/modules/m2sci/macros/sci_files/sci_int16.sci b/modules/m2sci/macros/sci_files/sci_int16.sci new file mode 100755 index 000000000..0008bb3a3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int16.sci @@ -0,0 +1,55 @@ +// 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]=sci_int16(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int16() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int16() + + // %c_int16 and %b_int16 are not defined in Scilab + x = getrhs(tree) + + // Matlab int16() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int16","int16"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int16","int16"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int16" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int32.bin b/modules/m2sci/macros/sci_files/sci_int32.bin Binary files differnew file mode 100755 index 000000000..be4a91226 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int32.bin diff --git a/modules/m2sci/macros/sci_files/sci_int32.sci b/modules/m2sci/macros/sci_files/sci_int32.sci new file mode 100755 index 000000000..97f860fa1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int32.sci @@ -0,0 +1,55 @@ +// 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]=sci_int32(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int32() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int32() + + // %c_int32 and %b_int32 are not defined in Scilab + x = getrhs(tree) + + // Matlab int32() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int32","int32"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int32","int32"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int32" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_int8.bin b/modules/m2sci/macros/sci_files/sci_int8.bin Binary files differnew file mode 100755 index 000000000..f86d59cde --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int8.bin diff --git a/modules/m2sci/macros/sci_files/sci_int8.sci b/modules/m2sci/macros/sci_files/sci_int8.sci new file mode 100755 index 000000000..9cb641e50 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_int8.sci @@ -0,0 +1,55 @@ +// 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]=sci_int8(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab int8() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_int8() + + // %c_int8 and %b_int8 are not defined in Scilab + x = getrhs(tree) + + // Matlab int8() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int8","int8"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"int8","int8"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_int8" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_interp1.bin b/modules/m2sci/macros/sci_files/sci_interp1.bin Binary files differnew file mode 100755 index 000000000..e7717db52 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_interp1.bin diff --git a/modules/m2sci/macros/sci_files/sci_interp1.sci b/modules/m2sci/macros/sci_files/sci_interp1.sci new file mode 100755 index 000000000..1a9b7c269 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_interp1.sci @@ -0,0 +1,67 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_interp1(tree) + // M2SCI function + // Conversion function for Matlab interp1() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then // y=interp1(y,xi) + y=tree.rhs(1) + xi=tree.rhs(2) + elseif rhs>=3 then + A=tree.rhs(3) + if A.vtype==-1 then + tree.lhs(1).dims==list(-1,-1) + elseif A.vtype==1 then // y=interp1(x,y,xi,..) + y=tree.rhs(2) + xi=tree.rhs(3) + elseif A.vtype==10 then // y=interp1(x,y,'method',..) + y=tree.rhs(1) + xi=tree.rhs(2) + end + end + + if (rhs>=3 & (A.vtype==1 | A.vtype==10)) | rhs==2 then + ydimknown=%t // ydimknown : a boolean, true if all dimensions of y are known + xidimknown=%t // xidimknown : a boolean, true if all dimensions of xi are known + for i=1:size(xi.dims) + if xi.dims(i)==-1 then + xidimknown=%f + break + end + end + for i=1:size(y.dims) + if y.dims(i)==-1 then + ydimknown=%f + break + end + end + if is_a_vector(y) then // y a vector + if xidimknown then // xi a scalar or a vector or a matrix or a hypermatrix + tree.lhs(1).dims=xi.dims + else // dimension(s) of xi is unknown + tree.lhs(1).dims=list(-1,-1) + end + elseif ydimknown then // y is a matrix or a hypermatrix + if xidimknown then // xi a scalar or a vector or a matrix or a hypermatrix + tree.lhs(1).dims==xi.dims + for i=1:size(xi.dims)-1 + tree.lhs(1).dims(i+size(xi.dims))=y.dims(i+1) + end + else // dimension(s) of xi is unknown + tree.lhs(1).dims==list(-1,-1) + end + else // dimension(s) of y is unknown + tree.lhs(1).dims=list(-1,-1) + end + end + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_inv.bin b/modules/m2sci/macros/sci_files/sci_inv.bin Binary files differnew file mode 100755 index 000000000..968b6c32c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_inv.bin diff --git a/modules/m2sci/macros/sci_files/sci_inv.sci b/modules/m2sci/macros/sci_files/sci_inv.sci new file mode 100755 index 000000000..cd06be900 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_inv.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]=sci_inv(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab inv() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="inv" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isa.bin b/modules/m2sci/macros/sci_files/sci_isa.bin Binary files differnew file mode 100755 index 000000000..1259c6749 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isa.bin diff --git a/modules/m2sci/macros/sci_files/sci_isa.sci b/modules/m2sci/macros/sci_files/sci_isa.sci new file mode 100755 index 000000000..f079ba0c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isa.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]=sci_isa(tree) + // M2SCI function + // Conversion function for Matlab isa() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + [OBJ,class] = getrhs(tree) + + if typeof(class)=="cste" then + + typetree=Funcall("type",1,Rhs_tlist(OBJ),list()) + typeoftree=Funcall("typeof",1,Rhs_tlist(OBJ),list()) + + select class.value + case "logical" + tree=Operation("==",list(typetree,Cste(4)),tree.lhs) + case "char" + tree=Operation("==",list(typetree,Cste(10)),tree.lhs) + case "numeric" + catop=Operation("rc",list(Cste(1),Cste(5)),list()) + catop=Operation("rc",list(catop,Cste(8)),list()) + eqtree=Operation("==",list(typetree,catop),list()) + tree=Funcall("or",1,list(eqtree),list(tree.lhs(1))) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + return + case "int8" + tree=Operation("==",list(typeoftree,Cste("int8")),tree.lhs) + case "uint8" + tree=Operation("==",list(typeoftree,Cste("uint8")),tree.lhs) + case "int16" + tree=Operation("==",list(typeoftree,Cste("int16")),tree.lhs) + case "uint16" + tree=Operation("==",list(typeoftree,Cste("uint16")),tree.lhs) + case "int32" + tree=Operation("==",list(typeoftree,Cste("int32")),tree.lhs) + case "uint32" + tree=Operation("==",list(typeoftree,Cste("uint32")),tree.lhs) + case "single" + tree=Operation("==",list(typetree,Cste(1)),tree.lhs) + case "double" + tree=Operation("==",list(typetree,Cste(1)),tree.lhs) + case "cell" + tree=Operation("==",list(typeoftree,Cste("ce")),tree.lhs) + case "struct" + tree=Operation("==",list(typeoftree,Cste("st")),tree.lhs) + case "function_handle" + tree=Operation("==",list(typetree,Cste(13)),tree.lhs) + case "sparse" + tree=Operation("==",list(typetree,Cste(5)),tree.lhs) + case "lti" + tree=Operation("==",list(typeoftree,Cste("state-space")),tree.lhs) + else + set_infos(msprintf(gettext("Unhandled class: %s."),class.value),2) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + return + end + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + else + tree.name="mtlb_isa" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_iscell.bin b/modules/m2sci/macros/sci_files/sci_iscell.bin Binary files differnew file mode 100755 index 000000000..a7d62a00a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_iscell.bin diff --git a/modules/m2sci/macros/sci_files/sci_iscell.sci b/modules/m2sci/macros/sci_files/sci_iscell.sci new file mode 100755 index 000000000..7c5f95903 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_iscell.sci @@ -0,0 +1,22 @@ +// 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]=sci_iscell(tree) + // M2SCI function + // Conversion function for Matlab iscell() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("typeof",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste("ce")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ischar.bin b/modules/m2sci/macros/sci_files/sci_ischar.bin Binary files differnew file mode 100755 index 000000000..3253d3455 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ischar.bin diff --git a/modules/m2sci/macros/sci_files/sci_ischar.sci b/modules/m2sci/macros/sci_files/sci_ischar.sci new file mode 100755 index 000000000..063accae1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ischar.sci @@ -0,0 +1,22 @@ +// 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]=sci_ischar(tree) + // M2SCI function + // Conversion function for Matlab ischar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(10)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isdir.bin b/modules/m2sci/macros/sci_files/sci_isdir.bin Binary files differnew file mode 100755 index 000000000..92aecaf0f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isdir.bin diff --git a/modules/m2sci/macros/sci_files/sci_isdir.sci b/modules/m2sci/macros/sci_files/sci_isdir.sci new file mode 100755 index 000000000..7173ade9e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isdir.sci @@ -0,0 +1,18 @@ +// 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]=sci_isdir(tree) + // M2SCI function + // Conversion function for Matlab isdir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isempty.bin b/modules/m2sci/macros/sci_files/sci_isempty.bin Binary files differnew file mode 100755 index 000000000..8a00d6596 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isempty.bin diff --git a/modules/m2sci/macros/sci_files/sci_isempty.sci b/modules/m2sci/macros/sci_files/sci_isempty.sci new file mode 100755 index 000000000..1ec1ce98b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isempty.sci @@ -0,0 +1,18 @@ +// 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]=sci_isempty(tree) + // M2SCI function + // Conversion function for Matlab isempty() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isequal.bin b/modules/m2sci/macros/sci_files/sci_isequal.bin Binary files differnew file mode 100755 index 000000000..dccf91966 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isequal.bin diff --git a/modules/m2sci/macros/sci_files/sci_isequal.sci b/modules/m2sci/macros/sci_files/sci_isequal.sci new file mode 100755 index 000000000..63b46e771 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isequal.sci @@ -0,0 +1,22 @@ +// 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]=sci_isequal(tree) + // M2SCI function + // Conversion function for Matlab isequal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if tree.rhs(1).vtype==Struct then + set_infos(gettext("isequal requires fields are in the same order for structs to be equal."),2); + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isfield.bin b/modules/m2sci/macros/sci_files/sci_isfield.bin Binary files differnew file mode 100755 index 000000000..8b40843c7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfield.bin diff --git a/modules/m2sci/macros/sci_files/sci_isfield.sci b/modules/m2sci/macros/sci_files/sci_isfield.sci new file mode 100755 index 000000000..30bb0177c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfield.sci @@ -0,0 +1,37 @@ +// 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]=sci_isfield(tree) + // M2SCI function + // Conversion function for Matlab isfield() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + st=tree.rhs(1) + f=tree.rhs(2) + if and(st.vtype<>[Struct,Unknown]) then + tree=Cste(%F) + elseif st.vtype==Unknown then + tree.name="mtlb_tree" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + else + // allf=getfield(1,st);tf=or(allf(3:$)==f); + allf=gettempvar() + insert(Equal(list(allf),Funcall("getfield",1,Rhs_tlist(1,st),list()))) + + imp=Operation(":",list(Cste(3),Cste("$")),list()) + ext=Operation("ext",list(allf,imp),list()) + eq=Operation("==",list(ext,f),list()) + + tree=Funcall("or",1,Rhs_tlist(eq),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isfinite.bin b/modules/m2sci/macros/sci_files/sci_isfinite.bin Binary files differnew file mode 100755 index 000000000..db45e68f1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfinite.bin diff --git a/modules/m2sci/macros/sci_files/sci_isfinite.sci b/modules/m2sci/macros/sci_files/sci_isfinite.sci new file mode 100755 index 000000000..feeee9ce5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isfinite.sci @@ -0,0 +1,26 @@ +// 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]=sci_isfinite(tree) + // M2SCI function + // Conversion function for Matlab isfinite() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isfinite and %b_isfinite are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree=Funcall("abs",1,list(A),tree.lhs) + tree=Operation("<",list(tree,Cste(%inf)),tree.lhs) + + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isglobal.bin b/modules/m2sci/macros/sci_files/sci_isglobal.bin Binary files differnew file mode 100755 index 000000000..7f477df6b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isglobal.bin diff --git a/modules/m2sci/macros/sci_files/sci_isglobal.sci b/modules/m2sci/macros/sci_files/sci_isglobal.sci new file mode 100755 index 000000000..2157be8a5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isglobal.sci @@ -0,0 +1,19 @@ +// 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]=sci_isglobal(tree) + // M2SCI function + // Conversion function for Matlab isglobal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ishandle.bin b/modules/m2sci/macros/sci_files/sci_ishandle.bin Binary files differnew file mode 100755 index 000000000..45d3a48c3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishandle.bin diff --git a/modules/m2sci/macros/sci_files/sci_ishandle.sci b/modules/m2sci/macros/sci_files/sci_ishandle.sci new file mode 100755 index 000000000..06ccee948 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishandle.sci @@ -0,0 +1,23 @@ +// 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]=sci_ishandle(tree) + // M2SCI function + // Conversion function for Matlab ishandle() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(9)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ishold.bin b/modules/m2sci/macros/sci_files/sci_ishold.bin Binary files differnew file mode 100755 index 000000000..242eaf8f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishold.bin diff --git a/modules/m2sci/macros/sci_files/sci_ishold.sci b/modules/m2sci/macros/sci_files/sci_ishold.sci new file mode 100755 index 000000000..e4a04b658 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ishold.sci @@ -0,0 +1,23 @@ +// 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]=sci_ishold(tree) + // M2SCI function + // Conversion function for Matlab ishold() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + gca_funcall=Funcall("gca",1,list(),list()) + get_funcall=Funcall("get",1,Rhs_tlist(gca_funcall,"auto_clear"),list()) + tree=Operation("==",list(get_funcall,Cste("off")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isinf.bin b/modules/m2sci/macros/sci_files/sci_isinf.bin Binary files differnew file mode 100755 index 000000000..ffd561ef2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinf.bin diff --git a/modules/m2sci/macros/sci_files/sci_isinf.sci b/modules/m2sci/macros/sci_files/sci_isinf.sci new file mode 100755 index 000000000..7046c21d8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinf.sci @@ -0,0 +1,23 @@ +// 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]=sci_isinf(tree) + // M2SCI function + // Conversion function for Matlab isinf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isinf and %b_isinf are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isinteger.bin b/modules/m2sci/macros/sci_files/sci_isinteger.bin Binary files differnew file mode 100755 index 000000000..ef35869b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinteger.bin diff --git a/modules/m2sci/macros/sci_files/sci_isinteger.sci b/modules/m2sci/macros/sci_files/sci_isinteger.sci new file mode 100755 index 000000000..0a795d68d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isinteger.sci @@ -0,0 +1,22 @@ +// 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]=sci_isinteger(tree) + // M2SCI function + // Conversion function for Matlab isinteger() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(8)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isletter.bin b/modules/m2sci/macros/sci_files/sci_isletter.bin Binary files differnew file mode 100755 index 000000000..305549251 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isletter.bin diff --git a/modules/m2sci/macros/sci_files/sci_isletter.sci b/modules/m2sci/macros/sci_files/sci_isletter.sci new file mode 100755 index 000000000..495cd5d5c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isletter.sci @@ -0,0 +1,22 @@ +// 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]=sci_isletter(tree) + // M2SCI function + // Conversion function for Matlab isletter() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_isletter() + + tree.name="mtlb_isletter" + + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_islogical.bin b/modules/m2sci/macros/sci_files/sci_islogical.bin Binary files differnew file mode 100755 index 000000000..99fa9ac12 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_islogical.bin diff --git a/modules/m2sci/macros/sci_files/sci_islogical.sci b/modules/m2sci/macros/sci_files/sci_islogical.sci new file mode 100755 index 000000000..51577505a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_islogical.sci @@ -0,0 +1,24 @@ +// 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]=sci_islogical(tree) + // M2SCI function + // Conversion function for Matlab islogical() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + mat=Operation("rc",list(Cste(4),Cste(6)),list()) + tree=Operation("==",list(A,mat),tree.lhs) + tree=Funcall("or",1,list(tree),tree.out) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isnan.bin b/modules/m2sci/macros/sci_files/sci_isnan.bin Binary files differnew file mode 100755 index 000000000..488cd00aa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnan.bin diff --git a/modules/m2sci/macros/sci_files/sci_isnan.sci b/modules/m2sci/macros/sci_files/sci_isnan.sci new file mode 100755 index 000000000..3fc592256 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnan.sci @@ -0,0 +1,23 @@ +// 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]=sci_isnan(tree) + // M2SCI function + // Conversion function for Matlab isnan() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isnan and %b_isnan are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isnumeric.bin b/modules/m2sci/macros/sci_files/sci_isnumeric.bin Binary files differnew file mode 100755 index 000000000..b6ac51fe6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnumeric.bin diff --git a/modules/m2sci/macros/sci_files/sci_isnumeric.sci b/modules/m2sci/macros/sci_files/sci_isnumeric.sci new file mode 100755 index 000000000..827e0bbc8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isnumeric.sci @@ -0,0 +1,26 @@ +// 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]=sci_isnumeric(tree) + // M2SCI function + // Conversion function for Matlab isnumeric() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // tf = or(type(A)==[1 5 8]) + rc15=Operation("rc",list(Cste(1),Cste(5)),list()) + rc158=Operation("rc",list(rc15,Cste(8)),list()) + type_funcall=Funcall("type",1,list(tree.rhs(1)),list()) + eq=Operation("==",list(type_funcall,rc158),list()) + tree=Funcall("or",1,Rhs_tlist(eq),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ispc.bin b/modules/m2sci/macros/sci_files/sci_ispc.bin Binary files differnew file mode 100755 index 000000000..a61cf6e4e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ispc.bin diff --git a/modules/m2sci/macros/sci_files/sci_ispc.sci b/modules/m2sci/macros/sci_files/sci_ispc.sci new file mode 100755 index 000000000..b0b101a9e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ispc.sci @@ -0,0 +1,18 @@ +// 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]=sci_ispc(tree) + // M2SCI function + // Conversion function for Matlab ispc() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Variable("MSDOS",Infer(list(1,1),Type(Boolean,Real))) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isreal.bin b/modules/m2sci/macros/sci_files/sci_isreal.bin Binary files differnew file mode 100755 index 000000000..6e82eb7f7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isreal.bin diff --git a/modules/m2sci/macros/sci_files/sci_isreal.sci b/modules/m2sci/macros/sci_files/sci_isreal.sci new file mode 100755 index 000000000..2e1084035 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isreal.sci @@ -0,0 +1,26 @@ +// 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]=sci_isreal(tree) + // M2SCI function + // Conversion function for Matlab isreal() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_isreal and %b_isreal are not defined in Scilab + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // eps set to 0 + tree.rhs=Rhs_tlist(A,0) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isscalar.bin b/modules/m2sci/macros/sci_files/sci_isscalar.bin Binary files differnew file mode 100755 index 000000000..d5134773f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isscalar.bin diff --git a/modules/m2sci/macros/sci_files/sci_isscalar.sci b/modules/m2sci/macros/sci_files/sci_isscalar.sci new file mode 100755 index 000000000..c771faf0b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isscalar.sci @@ -0,0 +1,23 @@ +// 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]=sci_isscalar(tree) + // M2SCI function + // Conversion function for Matlab isscalar() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + lgth_funcall=Funcall("length",1,tree.rhs,list()) + sum_funcall=Funcall("sum",1,Rhs_tlist(lgth_funcall),list()) + tree=Operation("==",list(sum_funcall,Cste(1)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isspace.bin b/modules/m2sci/macros/sci_files/sci_isspace.bin Binary files differnew file mode 100755 index 000000000..b47ddf8c0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isspace.bin diff --git a/modules/m2sci/macros/sci_files/sci_isspace.sci b/modules/m2sci/macros/sci_files/sci_isspace.sci new file mode 100755 index 000000000..4d0f469ec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isspace.sci @@ -0,0 +1,34 @@ +// 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]=sci_isspace(tree) + // M2SCI function + // Conversion function for Matlab isspace() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_isspace() + + A = getrhs(tree) + + if A.vtype==String then + A = Funcall("asciimat",1,Rhs_tlist(A),list(Variable("",A.infer))) + tree = Operation("==",list(A,Cste(32)),tree.lhs) + tree.out(1).dims=A.dims + tree.out(1).type=Type(Boolean,Real) + elseif or(A.vtype==[Double,Boolean]) then + tree.name="zeros" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) + else + tree.name="mtlb_isspace" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Boolean,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_issparse.bin b/modules/m2sci/macros/sci_files/sci_issparse.bin Binary files differnew file mode 100755 index 000000000..41113fa61 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_issparse.bin diff --git a/modules/m2sci/macros/sci_files/sci_issparse.sci b/modules/m2sci/macros/sci_files/sci_issparse.sci new file mode 100755 index 000000000..4bb1afb25 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_issparse.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]=sci_issparse(tree) + // M2SCI function + // Conversion function for Matlab issparse() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + mat=Operation("rc",list(Cste(5),Cste(6)),list()) + tree=Operation("==",list(A,mat),tree.lhs) + tree=Funcall("or",1,list(tree),tree.out) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isstr.bin b/modules/m2sci/macros/sci_files/sci_isstr.bin Binary files differnew file mode 100755 index 000000000..36d82e013 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstr.bin diff --git a/modules/m2sci/macros/sci_files/sci_isstr.sci b/modules/m2sci/macros/sci_files/sci_isstr.sci new file mode 100755 index 000000000..8b2202ca5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstr.sci @@ -0,0 +1,22 @@ +// 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]=sci_isstr(tree) + // M2SCI function + // Conversion function for Matlab isstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("type",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste(10)),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isstruct.bin b/modules/m2sci/macros/sci_files/sci_isstruct.bin Binary files differnew file mode 100755 index 000000000..9a8818923 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstruct.bin diff --git a/modules/m2sci/macros/sci_files/sci_isstruct.sci b/modules/m2sci/macros/sci_files/sci_isstruct.sci new file mode 100755 index 000000000..f92fc17c2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isstruct.sci @@ -0,0 +1,22 @@ +// 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]=sci_isstruct(tree) + // M2SCI function + // Conversion function for Matlab isstruct() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + A=Funcall("typeof",1,Rhs_tlist(A),list()) + tree=Operation("==",list(A,Cste("st")),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isunix.bin b/modules/m2sci/macros/sci_files/sci_isunix.bin Binary files differnew file mode 100755 index 000000000..eb3b6daed --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isunix.bin diff --git a/modules/m2sci/macros/sci_files/sci_isunix.sci b/modules/m2sci/macros/sci_files/sci_isunix.sci new file mode 100755 index 000000000..41de62042 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isunix.sci @@ -0,0 +1,21 @@ +// 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]=sci_isunix(tree) + // M2SCI function + // Conversion function for Matlab isunix() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree=Operation("~",list(Variable("MSDOS",Infer(list(1,1),Type(Boolean,Real)))),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_isvector.bin b/modules/m2sci/macros/sci_files/sci_isvector.bin Binary files differnew file mode 100755 index 000000000..f2ea07b97 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isvector.bin diff --git a/modules/m2sci/macros/sci_files/sci_isvector.sci b/modules/m2sci/macros/sci_files/sci_isvector.sci new file mode 100755 index 000000000..096a72e14 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_isvector.sci @@ -0,0 +1,31 @@ +// 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]=sci_isvector(tree) + // M2SCI function + // Conversion function for Matlab isvector() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if or(tree.rhs(1).vtype==[String,Unknown]) then + tree.rhs(1)=convert2double(tree.rhs(1)) + end + + rowsize=Funcall("size",1,Rhs_tlist(tree.rhs(1),1),list()) + colsize=Funcall("size",1,Rhs_tlist(tree.rhs(1),2),list()) + + rowsizeeq=Operation("==",list(rowsize,Cste(1)),list()) + colsizeeq=Operation("==",list(colsize,Cste(1)),list()) + + tree=Operation("|",list(rowsizeeq,colsizeeq),tree.lhs) + + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_keyboard.bin b/modules/m2sci/macros/sci_files/sci_keyboard.bin Binary files differnew file mode 100755 index 000000000..dc9c5b2b0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_keyboard.bin diff --git a/modules/m2sci/macros/sci_files/sci_keyboard.sci b/modules/m2sci/macros/sci_files/sci_keyboard.sci new file mode 100755 index 000000000..75e6dea42 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_keyboard.sci @@ -0,0 +1,18 @@ +// 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]=sci_keyboard(tree) + // M2SCI function + // Conversion function for Matlab keyboard() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="pause" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_kron.bin b/modules/m2sci/macros/sci_files/sci_kron.bin Binary files differnew file mode 100755 index 000000000..ba643592b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_kron.bin diff --git a/modules/m2sci/macros/sci_files/sci_kron.sci b/modules/m2sci/macros/sci_files/sci_kron.sci new file mode 100755 index 000000000..3e61021c9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_kron.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]=sci_kron(tree) + // M2SCI function + // Conversion function for Matlab kron() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Scilab .*. operator does no work with Strings... + if tree.rhs(1).vtype<>Double then + tree.rhs(1)=convert2double(tree.rhs(1)) + end + if tree.rhs(2).vtype<>Double then + tree.rhs(2)=convert2double(tree.rhs(2)) + end + + tree=Operation(".*.",tree.rhs,tree.lhs) + + tree.out(1).type=Type(Double,Unknown) + + if is_a_scalar(tree.operands(1)) then + tree.out(1).dims=tree.operands(2).dims + elseif is_a_scalar(tree.operands(2)) then + tree.out(1).dims=tree.operands(1).dims + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_legendre.bin b/modules/m2sci/macros/sci_files/sci_legendre.bin Binary files differnew file mode 100755 index 000000000..9aefd6802 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_legendre.bin diff --git a/modules/m2sci/macros/sci_files/sci_legendre.sci b/modules/m2sci/macros/sci_files/sci_legendre.sci new file mode 100755 index 000000000..c02f28cb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_legendre.sci @@ -0,0 +1,43 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_legendre(tree) + // M2SCI function + // Conversion function for Matlab legendre() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_legendre() + + tree.name = "mtlb_legendre"; + boolknowndims = %t; + dims = list(); + for i=1:size(tree.rhs(2).dims) + if tree.rhs(2).dims(i) == -1 then + boolknowndims = %f; + break + end + dims($+1) = tree.rhs(2).dims(i); + end + + if boolknowndims then + if typeof(tree.rhs(1)) == "cste" + if tree.rhs(1).value > 0 then + dims = list(tree.rhs(1).value+1,dims) + end + else + dims = list(-1,-1) + end + else + dims = list(-1,-1) + end + + tree.lhs(1).dims = dims; + tree.lhs(1).type = Type(Double,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_length.bin b/modules/m2sci/macros/sci_files/sci_length.bin Binary files differnew file mode 100755 index 000000000..b17e19d5f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_length.bin diff --git a/modules/m2sci/macros/sci_files/sci_length.sci b/modules/m2sci/macros/sci_files/sci_length.sci new file mode 100755 index 000000000..01b7474fa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_length.sci @@ -0,0 +1,32 @@ +// 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]=sci_length(tree) + // M2SCI function + // Conversion function for Matlab length() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + X = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + tree.rhs=list(X) + end + + if is_a_vector(X) then + tree=Funcall("size",1,Rhs_tlist(X,"*"),tree.lhs) + else + tree.name="size" + tree=Funcall("max",1,Rhs_tlist(tree),tree.lhs) + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_linspace.bin b/modules/m2sci/macros/sci_files/sci_linspace.bin Binary files differnew file mode 100755 index 000000000..baab27c93 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_linspace.bin diff --git a/modules/m2sci/macros/sci_files/sci_linspace.sci b/modules/m2sci/macros/sci_files/sci_linspace.sci new file mode 100755 index 000000000..40521e84a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_linspace.sci @@ -0,0 +1,54 @@ +// 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]=sci_linspace(tree) + // M2SCI function + // Conversion function for Matlab linspace() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_linspace() + + A=tree.rhs(1) + B=tree.rhs(2) + + // %c_linspace and %b_linspace are not defined + if is_complex(A) | is_complex(B) then + tree.lhs(1).property=Complex + elseif or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) then + tree.lhs(1).vtype=Unknown + else + tree.lhs(1).vtype=Double + end + + // y = linspace(A,B) + if rhs==2 then + tree.rhs=Rhs_tlist(A,B) + tree.lhs(1).dims=list(1,100); + if or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) then + tree.name = "mtlb_linspace"; + end + else + // y = linspace(A,B,n) + n=tree.rhs(3) + tree.rhs=Rhs_tlist(A,B,n) + if typeof(n)=="cste" & n.vtype==Double then + if isempty(n.value) then + tree.lhs(1).dims=list(1,1) + else + tree.lhs(1).dims=list(1,n.value) + end + else + tree.lhs(1).dims=list(1,Unknown) + end + if or(A.vtype==[String,Boolean,Unknown]) | or(B.vtype==[String,Boolean,Unknown]) | or(n.vtype==[String,Boolean,Unknown]) then + tree.name = "mtlb_linspace"; + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_load.bin b/modules/m2sci/macros/sci_files/sci_load.bin Binary files differnew file mode 100755 index 000000000..2210f5b47 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_load.bin diff --git a/modules/m2sci/macros/sci_files/sci_load.sci b/modules/m2sci/macros/sci_files/sci_load.sci new file mode 100755 index 000000000..19c2a49ba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_load.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]=sci_load(tree) + // M2SCI function + // Conversion function for Matlab load() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("varslist") + tree.name="loadmatfile" + + // If no rhs, then load all environment + if rhs<=0 then + tree.name="loadmatfile" + tree.rhs=Rhs_tlist("scilab.mat") + return + end + + for k=1:rhs + if typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-regexp" then + set_infos(gettext("Option -regexp not yet handled: will be ignored."),2); + end + if typeof(tree.rhs(k))=="cste" //& exists("sci_"+tree.rhs(k).value)==1 + INFER=Infer() + varslist($+1)=M2scivar(tree.rhs(k).value,tree.rhs(k).value,INFER) + end + if typeof(tree.rhs(k))=="operation" + for j=1:size(tree.rhs(k).operands) + if typeof(tree.rhs(k).operands(j))=="cste" //& exists("sci_"+tree.rhs(k).operands(j).value)==1 + INFER=Infer() + varslist($+1)=M2scivar(tree.rhs(k).operands(j).value,tree.rhs(k).operands(j).value,INFER) + end + end + end + end + rhstemp=list() + rhstemp($+1)=tree.rhs(1) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log.bin b/modules/m2sci/macros/sci_files/sci_log.bin Binary files differnew file mode 100755 index 000000000..610b1c093 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log.bin diff --git a/modules/m2sci/macros/sci_files/sci_log.sci b/modules/m2sci/macros/sci_files/sci_log.sci new file mode 100755 index 000000000..494867f47 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log.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]=sci_log(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab log() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="log" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log10.bin b/modules/m2sci/macros/sci_files/sci_log10.bin Binary files differnew file mode 100755 index 000000000..159cd2faa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log10.bin diff --git a/modules/m2sci/macros/sci_files/sci_log10.sci b/modules/m2sci/macros/sci_files/sci_log10.sci new file mode 100755 index 000000000..bd8954ce4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log10.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]=sci_log10(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab log10() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="log10" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_log2.bin b/modules/m2sci/macros/sci_files/sci_log2.bin Binary files differnew file mode 100755 index 000000000..36500f308 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log2.bin diff --git a/modules/m2sci/macros/sci_files/sci_log2.sci b/modules/m2sci/macros/sci_files/sci_log2.sci new file mode 100755 index 000000000..2f0b36b35 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_log2.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]=sci_log2(tree) + // M2SCI function + // Conversion function for Matlab log2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_log2/%c_frexp and %b_log2/%b_frexp are not defined in Scilab + X = getrhs(tree) + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + + // Y = log2(X) + if lhs==1 then + tree.lhs(1).infer=X.infer + // [F,E] = log2(X) + else + if is_complex(X) then + X = Funcall("real",1,list(X),list(Variable("",X.infer))) + elseif ~is_real(X) then + newX = Funcall("real",1,list(X),list(Variable("",X.infer))) + repl_poss(newX,X,X,gettext("is Real.")); + X=newX + end + tree.rhs=Rhs_tlist(X) + tree.name="frexp" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(Double,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_logical.bin b/modules/m2sci/macros/sci_files/sci_logical.bin Binary files differnew file mode 100755 index 000000000..01c445907 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logical.bin diff --git a/modules/m2sci/macros/sci_files/sci_logical.sci b/modules/m2sci/macros/sci_files/sci_logical.sci new file mode 100755 index 000000000..168866163 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logical.sci @@ -0,0 +1,47 @@ +// 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]=sci_logical(tree) + // M2SCI function + // Conversion function for Matlab logical() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_logical() + + X = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + tree.rhs=list(X) + end + + if is_empty(X) then + set_infos(msprintf(gettext("%s is an empty matrix, so result is set to []."),expression2code(X)),0); + tree=Cste([]) + elseif not_empty(X) then + if X.vtype==Boolean then + if typeof(X)=="operation" then + X.out(1)=tree.lhs(1) + elseif typeof(X)=="funcall" then + X.lhs(1)=tree.lhs(1) + end + + tree=X + else + tree=Operation("<>",list(X,Cste(0)),tree.lhs) + + tree.out(1).dims=X.dims + tree.out(1).type=Type(Boolean,Real) + end + else + tree.name="mtlb_logical" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_logm.bin b/modules/m2sci/macros/sci_files/sci_logm.bin Binary files differnew file mode 100755 index 000000000..2a62a800b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logm.bin diff --git a/modules/m2sci/macros/sci_files/sci_logm.sci b/modules/m2sci/macros/sci_files/sci_logm.sci new file mode 100755 index 000000000..c6814603a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_logm.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_logm(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab logm() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Unknown) + if size(tree.lhs)==2 + tree.lhs(2)=null() + set_infos(gettext("second output argument will be ignored."),2); + end +endfunction + + + + diff --git a/modules/m2sci/macros/sci_files/sci_lookfor.bin b/modules/m2sci/macros/sci_files/sci_lookfor.bin Binary files differnew file mode 100755 index 000000000..c96a64970 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lookfor.bin diff --git a/modules/m2sci/macros/sci_files/sci_lookfor.sci b/modules/m2sci/macros/sci_files/sci_lookfor.sci new file mode 100755 index 000000000..3d8f67116 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lookfor.sci @@ -0,0 +1,21 @@ +// 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]=sci_lookfor(tree) + // M2SCI function + // Conversion function for Matlab lookfor() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==2 then + no_equiv(gettext("-all option ignored.")) + tree.rhs(2)=null() + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_lower.bin b/modules/m2sci/macros/sci_files/sci_lower.bin Binary files differnew file mode 100755 index 000000000..5da18aab0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lower.bin diff --git a/modules/m2sci/macros/sci_files/sci_lower.sci b/modules/m2sci/macros/sci_files/sci_lower.sci new file mode 100755 index 000000000..7b0ed14af --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lower.sci @@ -0,0 +1,37 @@ +// 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]=sci_lower(tree) + // M2SCI function + // Conversion function for Matlab lower() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_lower() + + opt=part("lower",1) + + A = getrhs(tree) + if A.vtype==String then + tree.name="convstr" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + elseif A.vtype==Unknown then + tree.name="mtlb_lower" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_lu.bin b/modules/m2sci/macros/sci_files/sci_lu.bin Binary files differnew file mode 100755 index 000000000..3f3967a55 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lu.bin diff --git a/modules/m2sci/macros/sci_files/sci_lu.sci b/modules/m2sci/macros/sci_files/sci_lu.sci new file mode 100755 index 000000000..477bdebaa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_lu.sci @@ -0,0 +1,50 @@ +// 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]=sci_lu(tree) + // M2SCI function + // Conversion function for Matlab lu() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // lu(X) + if rhs==1 then + X = getrhs(tree) + X = convert2double(X) + tree.rhs=Rhs_tlist(X) + // Y = lu(X) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [L,U] = lu(X) + elseif lhs==2 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(X.vtype,Real) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=X.type + // [L,U,P] = lu(X) + elseif lhs==3 then + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(X.vtype,Real) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=X.type + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(X.vtype,Real) + // [L,U,P,Q] = lu(X) + else + no_equiv("["+tree.lhs(1).name+","+tree.lhs(2).name+","+tree.lhs(3).name+"] = "+expression2code(tree)) + end + // lu(X,thresh) + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_makecell.bin b/modules/m2sci/macros/sci_files/sci_makecell.bin Binary files differnew file mode 100755 index 000000000..156abc995 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_makecell.bin diff --git a/modules/m2sci/macros/sci_files/sci_makecell.sci b/modules/m2sci/macros/sci_files/sci_makecell.sci new file mode 100755 index 000000000..ebfb05eae --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_makecell.sci @@ -0,0 +1,87 @@ +// 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]=sci_makecell(tree) + // M2SCI function + // Conversion function for Matlab {} + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==0 then + tree.rhs(1)=Operation("rc",list(Cste(0),Cste(0)),list()) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Cell,Unknown) + tree.lhs(1).contents=Contents() + return + end + + dimsrhs=Operation("rc",list(Cste(double(tree.rhs(1).dims(1))),Cste(double(tree.rhs(1).dims(2)))),list()) + + inrhs=tree.rhs(1) + + tmprhslist=list() + tmprhslist(1)=dimsrhs + if double(tree.rhs(1).dims(1))<>1 then + + for kr=1:double(tree.rhs(1).dims(1))-1 + + for krhs=lstsize(tmprhslist):-1:2 + tmprhslist(krhs+1)=tmprhslist(krhs) + end + + tmprhslist(2)=inrhs.operands(2) + inrhs=inrhs.operands(1) + end + + for krhs=lstsize(tmprhslist):-1:2 + tmprhslist(krhs+1)=tmprhslist(krhs) + end + tmprhslist(2)=inrhs + + else + tmprhslist(2)=inrhs + end + + rhslist=list() + rhslist(1)=dimsrhs + if double(tree.rhs(1).dims(2))<>1 then + + tmprhslist(1)=null() + + for ksz=lstsize(tmprhslist):-1:1 + inrhs=tmprhslist(ksz) + for kr=1:double(tree.rhs(1).dims(2))-1 + + for krhs=lstsize(rhslist):-1:2 + rhslist(krhs+1)=rhslist(krhs) + end + + rhslist(2)=inrhs.operands(2) + inrhs=inrhs.operands(1) + end + + for krhs=lstsize(rhslist):-1:2 + rhslist(krhs+1)=rhslist(krhs) + end + rhslist(2)=inrhs + + end + else + rhslist=tmprhslist + end + + // Del cell in first rhslist(2) + rhslist(2)=rhslist(2).operands(2) + tree.lhs(1).dims=tree.rhs(1).dims + tree.lhs(1).type=tree.rhs(1).type + tree.lhs(1).contents=tree.rhs(1).contents + + tree.rhs=rhslist + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_max.bin b/modules/m2sci/macros/sci_files/sci_max.bin Binary files differnew file mode 100755 index 000000000..93b850754 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_max.bin diff --git a/modules/m2sci/macros/sci_files/sci_max.sci b/modules/m2sci/macros/sci_files/sci_max.sci new file mode 100755 index 000000000..66bfdbe28 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_max.sci @@ -0,0 +1,169 @@ +// 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]=sci_max(tree) + // File generated from sci_PROTO1.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab max() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_max() + + // C = max(A) or [C,I] = max(A) + if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = max(A) or [C,I] = max(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab max() does not work with complexes so mtlb_max() is called + tree.name="mtlb_max" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab max() does not work with complexes so mtlb_max() is called but can be replaced + tree.name="mtlb_max" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = max(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end + // C = max(A,B) + elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_max" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_max" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end + // C = max(A,[],dim) or [C,I] = max(A,[],dim) + else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = max(A,[],dim) or [C,I] = max(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab max() does not work when dim is greater than number of dims of A + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_max" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = max(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mean.bin b/modules/m2sci/macros/sci_files/sci_mean.bin Binary files differnew file mode 100755 index 000000000..2e51ac312 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mean.bin diff --git a/modules/m2sci/macros/sci_files/sci_mean.sci b/modules/m2sci/macros/sci_files/sci_mean.sci new file mode 100755 index 000000000..825278026 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mean.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]=sci_mean(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab mean() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_mean() + + // B = mean(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_mean and %C_mean are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"m") + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = mean(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_mean and %C_mean are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab mean() does not work when dim is greater than number of dims A + tree.name="mtlb_mean" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_mean" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_median.bin b/modules/m2sci/macros/sci_files/sci_median.bin Binary files differnew file mode 100755 index 000000000..c3c259f20 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_median.bin diff --git a/modules/m2sci/macros/sci_files/sci_median.sci b/modules/m2sci/macros/sci_files/sci_median.sci new file mode 100755 index 000000000..7caaa090b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_median.sci @@ -0,0 +1,73 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_median(tree) + // M2SCI function + // Conversion function for Matlab median() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_median() + + // B = median(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_median and %C_median are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"m") + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = median(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_median and %C_median are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_meshgrid.bin b/modules/m2sci/macros/sci_files/sci_meshgrid.bin Binary files differnew file mode 100755 index 000000000..8fc6ca86b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_meshgrid.bin diff --git a/modules/m2sci/macros/sci_files/sci_meshgrid.sci b/modules/m2sci/macros/sci_files/sci_meshgrid.sci new file mode 100755 index 000000000..db62b84c6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_meshgrid.sci @@ -0,0 +1,67 @@ +// 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]=sci_meshgrid(tree) + // M2SCI function + // Conversion function for Matlab meshgrid() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 + A=getrhs(tree); + A=convert2double(A); + tree.rhs=Rhs_tlist(A); + elseif rhs==2 + [A,B]=getrhs(tree); + A=convert2double(A); + B=convert2double(B); + tree.rhs=Rhs_tlist(A,B); + end + + if lhs==1 + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + elseif lhs==2 + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + if rhs==1 + tree.lhs(2).dims=tree.lhs(1).dims; + else + if tree.rhs(2).dims(1)<>Unknown + tree.lhs(2).dims=list(tree.rhs(2).dims(1),tree.rhs(2).dims(1)); + else + tree.lhs(2).dims=list(tree.rhs(2).dims(2),tree.rhs(2).dims(2)); + end + end + else + if tree.rhs(1).dims(1)<>Unknown + tree.lhs(1).dims=list(tree.rhs(1).dims(1),tree.rhs(1).dims(1)); + else + tree.lhs(1).dims=list(tree.rhs(1).dims(2),tree.rhs(1).dims(2)); + end + + if tree.rhs(2).dims(1)<>Unknown + tree.lhs(2).dims=list(tree.rhs(2).dims(1),tree.rhs(2).dims(1)); + else + tree.lhs(2).dims=list(tree.rhs(2).dims(2),tree.rhs(2).dims(2)); + end + + if tree.rhs(3).dims(1)<>Unknown + tree.lhs(3).dims=list(tree.rhs(3).dims(1),tree.rhs(3).dims(1)); + else + tree.lhs(3).dims=list(tree.rhs(3).dims(2),tree.rhs(3).dims(2)); + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_min.bin b/modules/m2sci/macros/sci_files/sci_min.bin Binary files differnew file mode 100755 index 000000000..16b381ef0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_min.bin diff --git a/modules/m2sci/macros/sci_files/sci_min.sci b/modules/m2sci/macros/sci_files/sci_min.sci new file mode 100755 index 000000000..550bb60e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_min.sci @@ -0,0 +1,169 @@ +// 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]=sci_min(tree) + // File generated from sci_PROTO1.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab min() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_min() + + // C = min(A) or [C,I] = min(A) + if rhs==1 then + A = getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown // If A is a scalar then Matlab return Double type value else a Boolean type value + end + A = convert2double(A) + tree.rhs = Rhs_tlist(A) + dim = first_non_singleton(A) + + if dim==-1 then + // All output dims are unknown + tree.lhs(1).dims=allunknown(A.dims) + tmp=gettempvar() + insert(Equal(list(tmp),A)) + // First non singleton dimension will be computed at execution + tree.rhs=Rhs_tlist(tmp,Funcall("firstnonsingleton",1,list(tmp),list())) + else + tree.lhs(1).dims=A.dims + if dim==0 then + tree.rhs=Rhs_tlist(A) + if is_empty(A) then + tree.lhs(1).dims=A.dims + else + tree.lhs(1).dims=list(1,1) + end + elseif dim==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims(dim)=1 + elseif dim==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims(dim)=1 + end + end + + // C = min(A) or [C,I] = min(A) + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + elseif is_complex(A) then + // Scilab min() does not work with complexes so mtlb_min() is called + tree.name="mtlb_min" + tree.lhs(1).type=Type(Double,Unknown) + else + // Scilab min() does not work with complexes so mtlb_min() is called but can be replaced + tree.name="mtlb_min" + tree.lhs(1).type=Type(vtype,Unknown) + end + + // [C,I] = min(A) + if lhs==2 then + // All dims Unknown because if A is [] then I is also [] else I is a row vector + tree.lhs(2).dims=allunknown(A.dims) + tree.lhs(2).type=Type(Double,Real) + end + // C = min(A,B) + elseif rhs==2 then + [A,B]=getrhs(tree) + vtype=Double + if A.vtype==Boolean & B.vtype==Boolean | A.vtype==Unknown & B.vtype==Unknown then + vtype=Unknown + end + A=convert2double(A) + B=convert2double(B) + tree.rhs=Rhs_tlist(A,B) + + if is_real(A) & is_real(B) then + if not_empty(A) & not_empty(B) then + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + else + // Perhaps an input is an empty matrix + tree.name="mtlb_min" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Real) + end + else + // Inputs can be complexes and/or empty matrices + tree.name="mtlb_min" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(vtype,Unknown) + end + // C = min(A,[],dim) or [C,I] = min(A,[],dim) + else + [A,tmp,dim]=getrhs(tree) + vtype=Double + if or(A.vtype==[Boolean,Unknown]) then + vtype=Unknown + end + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + // C = min(A,[],dim) or [C,I] = min(A,[],dim) + if or(lhs==[1,2]) then + if is_real(A) then + tree.lhs(1).type=Type(vtype,Real) + if typeof(dim)=="cste" then + if dim.value==1 then + tree.rhs=Rhs_tlist(A,"r") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(1)=Unknown // 0 or 1 + elseif dim.value==2 then + tree.rhs=Rhs_tlist(A,"c") + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(2)=Unknown // 0 or 1 + elseif dim.value<=size(A.dims) then + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + else + // Scilab min() does not work when dim is greater than number of dims of A + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=A.dims + end + else + // If dim is 1 it can be replaced by 'r' + // If dim is 2 it can be replaced by 'c' + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + end + else + // A can be complex.... + tree.name="mtlb_min" + tree.rhs=Rhs_tlist(A,tmp,dim) + tree.lhs(1).dims=allunknown(A.dims) + tree.lhs(1).type=Type(vtype,Unknown) + end + end + + // [C,I] = min(A,[],dim) + if lhs==2 then + tree.lhs(2).type=Type(Double,Real) + if is_real(A) then + if typeof(dim)=="cste" then + if dim.value<=size(A.dims) then + tree.lhs(2).dims=allunknown(A.dims) + else + tree.lhs(2).dims=A.dims + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + else + tree.lhs(2).dims=allunknown(A.dims) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mkdir.bin b/modules/m2sci/macros/sci_files/sci_mkdir.bin Binary files differnew file mode 100755 index 000000000..3e9e5adba --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mkdir.bin diff --git a/modules/m2sci/macros/sci_files/sci_mkdir.sci b/modules/m2sci/macros/sci_files/sci_mkdir.sci new file mode 100755 index 000000000..358b6ccf6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mkdir.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]=sci_mkdir(tree) + // M2SCI function + // Conversion function for Matlab mkdir + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1); + tree.lhs(1).type=Type(Double,Real); + + if lhs>=2 then + tree.lhs(2).dims=list(1,Unknown); + tree.lhs(2).type=Type(String,Real); + end + + if lhs==3 then + no_equiv(msprintf(gettext("%s when called with three outputs."),expression2code(tree))); + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_mod.bin b/modules/m2sci/macros/sci_files/sci_mod.bin Binary files differnew file mode 100755 index 000000000..4d4ba2793 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mod.bin diff --git a/modules/m2sci/macros/sci_files/sci_mod.sci b/modules/m2sci/macros/sci_files/sci_mod.sci new file mode 100755 index 000000000..069ecffee --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_mod.sci @@ -0,0 +1,34 @@ +// 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]=sci_mod(tree) + // M2SCI function + // Conversion function for Matlab mod() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_r_c and %b_r_b are not defined in Scilab + [X,Y] = getrhs(tree) + X = convert2double(X) + Y = convert2double(Y) + tree.rhs=Rhs_tlist(X,Y) + + tree.name="pmodulo" + + if is_a_scalar(X) then + tree.lhs(1).dims=Y.dims + elseif is_a_scalar(Y) then + tree.lhs(1).dims=X.dims + elseif X.dims==Y.dims then + tree.lhs(1).dims=X.dims + else + tree.lhs(1).dims=allunknown(X.dims) + end + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_more.bin b/modules/m2sci/macros/sci_files/sci_more.bin Binary files differnew file mode 100755 index 000000000..b4cb39bec --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_more.bin diff --git a/modules/m2sci/macros/sci_files/sci_more.sci b/modules/m2sci/macros/sci_files/sci_more.sci new file mode 100755 index 000000000..aef42a54e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_more.sci @@ -0,0 +1,32 @@ +// 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]=sci_more(tree) + // M2SCI function + // Conversion function for Matlab more() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_more() + + opt=getrhs(tree) + + tree.name="lines" + if typeof(opt)=="cste" then + if opt.value=="off" then + tree.rhs=Rhs_tlist(0) + elseif opt.value=="on" then + tree.rhs=Rhs_tlist(60) + else + // Nothing to do + end + else + tree.name="mtlb_more" + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_nargin.bin b/modules/m2sci/macros/sci_files/sci_nargin.bin Binary files differnew file mode 100755 index 000000000..afd61e112 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargin.bin diff --git a/modules/m2sci/macros/sci_files/sci_nargin.sci b/modules/m2sci/macros/sci_files/sci_nargin.sci new file mode 100755 index 000000000..fef9e3da2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargin.sci @@ -0,0 +1,36 @@ +// 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]=sci_nargin(tree) + // File generated from sci_PROTO15.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab nargin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + global("varslist") + + if rhs==0 then // Number of arguments of local function + tree=Variable("%nargin",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("nargin","%nargin",Infer(list(1,1),Type(Double,Real))) + else // Number of arguments of M-file + if "nargin"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_nargout.bin b/modules/m2sci/macros/sci_files/sci_nargout.bin Binary files differnew file mode 100755 index 000000000..a2032902f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargout.bin diff --git a/modules/m2sci/macros/sci_files/sci_nargout.sci b/modules/m2sci/macros/sci_files/sci_nargout.sci new file mode 100755 index 000000000..813fb9d21 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_nargout.sci @@ -0,0 +1,36 @@ +// 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]=sci_nargout(tree) + // File generated from sci_PROTO15.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab nargout() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + global("varslist") + + if rhs==0 then // Number of arguments of local function + tree=Variable("%nargout",Infer(list(1,1),Type(Double,Real))) + varslist($+1)=M2scivar("nargout","%nargout",Infer(list(1,1),Type(Double,Real))) + else // Number of arguments of M-file + if "nargout"=="nargin" then + fieldnb=1 + else + fieldnb=2 + end + set_infos(msprintf(gettext("%s considered to be a Scilab macro."),rhs2code(tree.rhs)),2); + evstrtree=Funcall("evstr",1,tree.rhs,list()) + macrovartree=Funcall("macrovar",1,Rhs_tlist(evstrtree),list()) + getfieldtree=Funcall("getfield",1,Rhs_tlist(fieldnb,macrovartree),list()) + tree=Funcall("size",1,Rhs_tlist(getfieldtree,"*"),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ndims.bin b/modules/m2sci/macros/sci_files/sci_ndims.bin Binary files differnew file mode 100755 index 000000000..26e53f379 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ndims.bin diff --git a/modules/m2sci/macros/sci_files/sci_ndims.sci b/modules/m2sci/macros/sci_files/sci_ndims.sci new file mode 100755 index 000000000..4f4f27785 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ndims.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]=sci_ndims(tree) + // M2SCI function + // Conversion function for Matlab ndims() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + // Conversion to double is made to have the same results for strings + if or(A.vtype==[String,Unknown]) then + A = convert2double(A) + tree.rhs=list(A) + end + + tree.name="size" + tree=Funcall("size",1,Rhs_tlist(tree,"*"),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_norm.bin b/modules/m2sci/macros/sci_files/sci_norm.bin Binary files differnew file mode 100755 index 000000000..b0ff01915 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_norm.bin diff --git a/modules/m2sci/macros/sci_files/sci_norm.sci b/modules/m2sci/macros/sci_files/sci_norm.sci new file mode 100755 index 000000000..48a4d39bc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_norm.sci @@ -0,0 +1,32 @@ +// 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]=sci_norm(tree) + // M2SCI function + // Conversion function for Matlab norm() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_norm() + + // n = norm(A) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + // n = norm(A,p) + else + [A,p] = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,p) + end + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_now.bin b/modules/m2sci/macros/sci_files/sci_now.bin Binary files differnew file mode 100755 index 000000000..cad04e03c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_now.bin diff --git a/modules/m2sci/macros/sci_files/sci_now.sci b/modules/m2sci/macros/sci_files/sci_now.sci new file mode 100755 index 000000000..3df9152e5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_now.sci @@ -0,0 +1,21 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_now(tree) + // M2SCI function + // Conversion function for Matlab now() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.lhs)==1 then + tree.lhs(1).type=Type(Double,Real) + tree.lhs(1).dims=list(1,1) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_num2str.bin b/modules/m2sci/macros/sci_files/sci_num2str.bin Binary files differnew file mode 100755 index 000000000..24aea1e87 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_num2str.bin diff --git a/modules/m2sci/macros/sci_files/sci_num2str.sci b/modules/m2sci/macros/sci_files/sci_num2str.sci new file mode 100755 index 000000000..09f63e43a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_num2str.sci @@ -0,0 +1,30 @@ +// 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]=sci_num2str(tree) + // M2SCI function + // Conversion function for Matlab num2str() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs==1 then + set_infos(gettext("string output can be different from Matlab num2str output."),2) + tree.name="string" + else + if tree.rhs(2).vtype==String then + tree.name="msprintf" + tree.rhs=Rhs_tlist(tree.rhs(2),tree.rhs(1)) + elseif tree.rhs(2).vtype<>Unknown then + no_equiv(expression2code(tree)) + set_infos(gettext("See msprintf for solutions."),1); + else + tree.name="mtlb_num2str" + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_ones.bin b/modules/m2sci/macros/sci_files/sci_ones.bin Binary files differnew file mode 100755 index 000000000..1c1f907f7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ones.bin diff --git a/modules/m2sci/macros/sci_files/sci_ones.sci b/modules/m2sci/macros/sci_files/sci_ones.sci new file mode 100755 index 000000000..df0921ea0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ones.sci @@ -0,0 +1,176 @@ +// 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]=sci_ones(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab ones() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_ones() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // ones(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("ones",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // ones([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("ones",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // ones(n) or ones([n1,n2,...]) ? + else + tree.name="mtlb_ones" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // ones(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="ones" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_orth.bin b/modules/m2sci/macros/sci_files/sci_orth.bin Binary files differnew file mode 100755 index 000000000..7e1f665e8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_orth.bin diff --git a/modules/m2sci/macros/sci_files/sci_orth.sci b/modules/m2sci/macros/sci_files/sci_orth.sci new file mode 100755 index 000000000..432a70fc4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_orth.sci @@ -0,0 +1,19 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_orth(tree) + // M2SCI function + // Conversion function for Matlab orth() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.lhs(1).dims=list(A.dims(1),-1) + tree.lhs(1).type=Type(Double,A.property) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_pause.bin b/modules/m2sci/macros/sci_files/sci_pause.bin Binary files differnew file mode 100755 index 000000000..0b3a6a140 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pause.bin diff --git a/modules/m2sci/macros/sci_files/sci_pause.sci b/modules/m2sci/macros/sci_files/sci_pause.sci new file mode 100755 index 000000000..5425afeb6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pause.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]=sci_pause(tree) + // M2SCI function + // Conversion function for Matlab pause + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if rhs<1 then + tree.name="halt" + else + n = getrhs(tree) + if n.vtype==String then // pause on/off + no_equiv(expression2code(tree)); + else + tree.rhs=Rhs_tlist(Operation("*",list(Cste(1000),n),list())) + tree.name="xpause" + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_perms.bin b/modules/m2sci/macros/sci_files/sci_perms.bin Binary files differnew file mode 100755 index 000000000..dddea9dcf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_perms.bin diff --git a/modules/m2sci/macros/sci_files/sci_perms.sci b/modules/m2sci/macros/sci_files/sci_perms.sci new file mode 100755 index 000000000..11814c442 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_perms.sci @@ -0,0 +1,32 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_perms(tree) + // M2SCI function + // Conversion function for Matlab perms() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A=getrhs(tree) + tree.rhs=Rhs_tlist(A) + + if (type(tree.rhs(1).dims(1))==1 & tree.rhs(1).dims(1)==1) & (type(tree.rhs(1).dims(2))==1 & tree.rhs(1).dims(2)<>-1) then + tree.lhs(1).dims(1)=prod(1:tree.rhs(1).dims(2)) + tree.lhs(1).dims(2)=tree.rhs(1).dims(2) + elseif (type(tree.rhs(1).dims(2))==1 & tree.rhs(1).dims(2)==1) & (type(tree.rhs(1).dims(1))==1 & tree.rhs(1).dims(1)<>-1) then + tree.lhs(1).dims(1)=prod(1:tree.rhs(1).dims(1)) + tree.lhs(1).dims(2)=tree.rhs(1).dims(1) + else + tree.lhs(1).dims(1)=-1 + tree.lhs(1).dims(2)=-1 + end + + tree.lhs(1).type=tree.rhs(1).type + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_pie.bin b/modules/m2sci/macros/sci_files/sci_pie.bin Binary files differnew file mode 100755 index 000000000..6918af470 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pie.bin diff --git a/modules/m2sci/macros/sci_files/sci_pie.sci b/modules/m2sci/macros/sci_files/sci_pie.sci new file mode 100755 index 000000000..e414dff7d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pie.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_pie(tree) + // M2SCI function + // Conversion function for Matlab pie() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_plot.bin b/modules/m2sci/macros/sci_files/sci_plot.bin Binary files differnew file mode 100755 index 000000000..3058befcb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_plot.bin diff --git a/modules/m2sci/macros/sci_files/sci_plot.sci b/modules/m2sci/macros/sci_files/sci_plot.sci new file mode 100755 index 000000000..f55c7028b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_plot.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_plot(tree) + // M2SCI function + // Conversion function for Matlab plot() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_pow2.bin b/modules/m2sci/macros/sci_files/sci_pow2.bin Binary files differnew file mode 100755 index 000000000..16fe5d4a5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pow2.bin diff --git a/modules/m2sci/macros/sci_files/sci_pow2.sci b/modules/m2sci/macros/sci_files/sci_pow2.sci new file mode 100755 index 000000000..0df9e52a1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_pow2.sci @@ -0,0 +1,63 @@ +// 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]=sci_pow2(tree) + // M2SCI function + // Conversion function for Matlab pow2() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // X = pow2(Y) + if rhs==1 then + // %c_pow2 and %b_pow2 are not defined in Scilab + Y = getrhs(tree) + Y = convert2double(Y) + + tree=Operation(".^",list(Cste(2),Y),list(Variable(tree.lhs(1).name,Y.infer))) + // X = pow2(E,F) + else + // %c_pow2 and %b_pow2 are not defined in Scilab + [E,F] = getrhs(tree) + E = convert2double(E) + F = convert2double(F) + + // Imaginary parts are ignored by Matlab + if is_complex(E) then + E = Funcall("real",1,list(E),list(Variable("",E.infer))) + elseif ~is_real(E) then + newE = Funcall("real",1,list(E),list(Variable("",E.infer))) + repl_poss(newE,E,E,gettext("is Real.")); + E=newE + end + if is_complex(F) then + F = Funcall("real",1,list(F),list(Variable("",F.infer))) + elseif ~is_real(F) then + newF = Funcall("real",1,list(F),list(Variable("",F.infer))) + repl_poss(newF,F,F,gettext("is Real.")); + F=newF + end + + tmp=Operation(".^",list(Cste(2),F),list(Variable("",F.infer))) + + tree=Operation(".*",list(E,tmp),list(Variable(tree.lhs(1).name,Infer()))) + + if is_a_scalar(E) then + tree.out(1).dims=F.dims + elseif is_a_scalar(F) then + tree.out(1).dims=E.dims + elseif E.dims==F.dims then + tree.out(1).dims=E.dims + else + tree.out(1).dims=allunknown(E.dims) + end + tree.out(1).type=Type(Double,Real) + end + + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_primes.bin b/modules/m2sci/macros/sci_files/sci_primes.bin Binary files differnew file mode 100755 index 000000000..0a3a3582d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_primes.bin diff --git a/modules/m2sci/macros/sci_files/sci_primes.sci b/modules/m2sci/macros/sci_files/sci_primes.sci new file mode 100755 index 000000000..9b035cab5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_primes.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_primes(tree) + // M2SCI function + // Conversion function for Matlab primes() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims(1)=1 + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_prod.bin b/modules/m2sci/macros/sci_files/sci_prod.bin Binary files differnew file mode 100755 index 000000000..ce2721ac3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_prod.bin diff --git a/modules/m2sci/macros/sci_files/sci_prod.sci b/modules/m2sci/macros/sci_files/sci_prod.sci new file mode 100755 index 000000000..fb903fc77 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_prod.sci @@ -0,0 +1,82 @@ +// 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]=sci_prod(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab prod() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_prod() + + // B = prod(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_prod and %C_prod are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = prod(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_prod and %C_prod are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab prod() does not work when dim is greater than number of dims A + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_prod" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_qr.bin b/modules/m2sci/macros/sci_files/sci_qr.bin Binary files differnew file mode 100755 index 000000000..789a512cb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_qr.bin diff --git a/modules/m2sci/macros/sci_files/sci_qr.sci b/modules/m2sci/macros/sci_files/sci_qr.sci new file mode 100755 index 000000000..10a431271 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_qr.sci @@ -0,0 +1,86 @@ +// 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]=sci_qr(tree) + // M2SCI function + // Conversion function for Matlab qr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_qr() + + // qr(A) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + if is_real(A) then + prop=Real + else + prop=Unknown + end + // X = qr(A) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [Q,R] = qr(A) + elseif lhs==2 then + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(A.vtype,prop) + // [Q,R,E] = qr(A) + else + tree.lhs(1).dims=list(A.dims(1),A.dims(1)) + tree.lhs(1).type=A.type + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(A.vtype,prop) + tree.lhs(3).dims=list(A.dims(2),A.dims(2)) + tree.lhs(3).type=Type(A.vtype,prop) + end + // qr(A,0) + else + [A,B] = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,B) + if is_real(A) then + prop=Real + else + prop=Unknown + end + // R = qr(A,0) + if lhs==1 then + if tree.lhs(1).name=="ans" then + no_equiv(expression2code(tree)) + else + no_equiv(tree.lhs(1).name+" = "+expression2code(tree)) + end + // [Q,R] = qr(A,0) + elseif lhs==2 then + tree.rhs=Rhs_tlist(A,"e") + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=A.type + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=Type(A.vtype,prop) + // [Q,R,E] = qr(A,0) + else + set_infos(gettext("Scilab and Matlab qr() do not give same results for this case: mtlb_qr() is used."),0) + tree.name="mtlb_qr" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(A.vtype,prop) + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=Type(A.vtype,prop) + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(A.vtype,prop) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_quit.bin b/modules/m2sci/macros/sci_files/sci_quit.bin Binary files differnew file mode 100755 index 000000000..816ec4b89 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_quit.bin diff --git a/modules/m2sci/macros/sci_files/sci_quit.sci b/modules/m2sci/macros/sci_files/sci_quit.sci new file mode 100755 index 000000000..05f6bdcd1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_quit.sci @@ -0,0 +1,16 @@ +// 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]=sci_quit(tree) + // M2SCI function + // Conversion function for Matlab quit() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_rand.bin b/modules/m2sci/macros/sci_files/sci_rand.bin Binary files differnew file mode 100755 index 000000000..5ff5702c4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rand.bin diff --git a/modules/m2sci/macros/sci_files/sci_rand.sci b/modules/m2sci/macros/sci_files/sci_rand.sci new file mode 100755 index 000000000..f2962e66d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rand.sci @@ -0,0 +1,176 @@ +// 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]=sci_rand(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab rand() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_rand() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // rand(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("rand",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // rand([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("rand",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // rand(n) or rand([n1,n2,...]) ? + else + tree.name="mtlb_rand" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // rand(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="rand" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_randn.bin b/modules/m2sci/macros/sci_files/sci_randn.bin Binary files differnew file mode 100755 index 000000000..ad6a2d6c5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_randn.bin diff --git a/modules/m2sci/macros/sci_files/sci_randn.sci b/modules/m2sci/macros/sci_files/sci_randn.sci new file mode 100755 index 000000000..4bc1f7c46 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_randn.sci @@ -0,0 +1,176 @@ +// 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]=sci_randn(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab randn() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_randn() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // randn(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("rand",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // randn([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("rand",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // randn(n) or randn([n1,n2,...]) ? + else + tree.name="mtlb_randn" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // randn(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="rand" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_rcond.bin b/modules/m2sci/macros/sci_files/sci_rcond.bin Binary files differnew file mode 100755 index 000000000..0762070a2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rcond.bin diff --git a/modules/m2sci/macros/sci_files/sci_rcond.sci b/modules/m2sci/macros/sci_files/sci_rcond.sci new file mode 100755 index 000000000..9d964bd92 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rcond.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]=sci_rcond(tree) + // M2SCI function + // Conversion function for Matlab rcond() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_rcond() + + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + // If A can be an empty matrix... + if ~not_empty(A) then + tree.name="mtlb_rcond" + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_real.bin b/modules/m2sci/macros/sci_files/sci_real.bin Binary files differnew file mode 100755 index 000000000..a54b50f5a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_real.bin diff --git a/modules/m2sci/macros/sci_files/sci_real.sci b/modules/m2sci/macros/sci_files/sci_real.sci new file mode 100755 index 000000000..3f19bea4b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_real.sci @@ -0,0 +1,23 @@ +// 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]=sci_real(tree) + // Generic conversion function + // M2SCI function + // Conversion function for Matlab real() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_realmax.bin b/modules/m2sci/macros/sci_files/sci_realmax.bin Binary files differnew file mode 100755 index 000000000..747837e5c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmax.bin diff --git a/modules/m2sci/macros/sci_files/sci_realmax.sci b/modules/m2sci/macros/sci_files/sci_realmax.sci new file mode 100755 index 000000000..26219a244 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmax.sci @@ -0,0 +1,36 @@ +// 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=sci_realmax(tree) + // M2SCI function + // Conversion function for Matlab realmax() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_realmax() + + // realmax + if rhs<=0 then + tree.name="number_properties" + tree.rhs(1)=Cste("huge"); + // realmax('double') or realmax('single') + else + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="double" then + tree.name="number_properties" + tree.rhs(1)=Cste("huge"); + else + no_equiv(expression2code(tree)); + end + else + tree.name="mtlb_realmax"; + end + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_realmin.bin b/modules/m2sci/macros/sci_files/sci_realmin.bin Binary files differnew file mode 100755 index 000000000..99fcd7117 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmin.bin diff --git a/modules/m2sci/macros/sci_files/sci_realmin.sci b/modules/m2sci/macros/sci_files/sci_realmin.sci new file mode 100755 index 000000000..edb4f8cb7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_realmin.sci @@ -0,0 +1,36 @@ +// 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=sci_realmin(tree) + // M2SCI function + // Conversion function for Matlab realmin() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_realmin() + + // realmin + if rhs<=0 then + tree.name="number_properties" + tree.rhs(1)=Cste("tiny"); + // realmin('double') or realmin('single') + else + if typeof(tree.rhs(1))=="cste" then + if tree.rhs(1).value=="double" then + tree.name="number_properties" + tree.rhs(1)=Cste("tiny"); + else + no_equiv(expression2code(tree)); + end + else + tree.name="mtlb_realmin"; + end + end + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_rem.bin b/modules/m2sci/macros/sci_files/sci_rem.bin Binary files differnew file mode 100755 index 000000000..56c1ad737 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rem.bin diff --git a/modules/m2sci/macros/sci_files/sci_rem.sci b/modules/m2sci/macros/sci_files/sci_rem.sci new file mode 100755 index 000000000..040e8c5ce --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_rem.sci @@ -0,0 +1,45 @@ +// 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]=sci_rem(tree) + // M2SCI function + // Conversion function for Matlab rem() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // %c_d_c and %b_d_b are not defined in Scilab + [X,Y] = getrhs(tree) + X = convert2double(X) + Y = convert2double(Y) + tree.rhs=Rhs_tlist(X,Y) + + // X./Y + drd=Operation("./",tree.rhs,list()) + // fix(X./Y) + fix_funcall=Funcall("fix",1,list(drd),list()) + // fix(X./Y).*Y + drm=Operation(".*",list(fix_funcall,tree.rhs(2)),list()) + // X-fix(X./Y).*Y + tree=Operation("-",list(tree.rhs(1),drm),tree.lhs) + + if is_a_scalar(X) then + tree.out(1).dims=Y.dims + elseif is_a_scalar(Y) then + tree.out(1).dims=X.dims + elseif is_a_vector(X) then + tree.out(1).dims=X.dims + elseif is_a_vector(Y) then + tree.out(1).dims=Y.dims + else + tree.out(1).dims=X.dims + end + + tree.out(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_repmat.bin b/modules/m2sci/macros/sci_files/sci_repmat.bin Binary files differnew file mode 100755 index 000000000..165fad937 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_repmat.bin diff --git a/modules/m2sci/macros/sci_files/sci_repmat.sci b/modules/m2sci/macros/sci_files/sci_repmat.sci new file mode 100755 index 000000000..fac5b275a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_repmat.sci @@ -0,0 +1,123 @@ +// 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]=sci_repmat(tree) + // M2SCI function + // Conversion function for Matlab repmat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_repmat() + + // repmat(A,m) + if rhs==2 then + [A,m] = getrhs(tree) + vtype=A.vtype + if A.vtype==Unknown then + tree.name="mtlb_repmat" + if typeof(m)=="cste" then + for kd=1:lstsize(A.dims) + tree.lhs(1).dims(kd)=A.dims(kd)*m.value + if tree.lhs(1).dims(kd)<0 then + tree.lhs(1).dims(kd)=Unknown + end + end + end + tree.lhs(1).vtype=A.vtype + return + elseif A.vtype==Boolean then + A=convert2double(A) + elseif A.vtype==String then + A=convert2double(A) + end + + // repmat(A,m) equivalent to repmat(A,m,m) + if is_a_scalar(m) then + tree.rhs=list(m,m); + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + if typeof(m)=="cste" then + tree.out(1).dims=A.dims + for kd=1:2 + tree.out(1).dims(kd)=A.dims(kd)*m.value + if tree.out(1).dims(kd)<0 then + tree.out(1).dims(kd)=Unknown + end + end + end + tree.out(1).type=Type(A.vtype,A.property) + // repmat(A,[m,n,...]) + elseif not_a_scalar(m) + tmp=m + if typeof(m)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),m)) + end + newrhs=list() + for k=1:size(m.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + tree.rhs=newrhs; + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + tree.out(1).type=Type(Double,A.property) + // repmat(A,m) or repmat(A,[m,n,...]) + else + tree.name="mtlb_repmat" + tree.lhs(1).type=Type(A.vtype,A.property) + if or(vtype==[String,Boolean]) then + tree.lhs(1).type=Type(vtype,A.property) + end + return + end + // repmat(A,m,n) + else + [A,m,n] = getrhs(tree) + vtype=A.vtype + if A.vtype==Unknown then + tree.name="mtlb_repmat" + if is_a_scalar(A) & typeof(m)=="cste" then + tree.lhs(1).dims(1)=m.value + end + if is_a_scalar(A) & typeof(n)=="cste" then + tree.lhs(1).dims(2)=n.value + end + tree.lhs(1).vtype=A.vtype + return + elseif A.vtype==Boolean then + A=convert2double(A) + elseif A.vtype==String then + A=convert2double(A) + end + tree.rhs=Rhs_tlist(m,n) + tree.name="ones"; + tree=Operation(".*.",list(tree,A),tree.lhs) + + if typeof(m)=="cste" & typeof(n)=="cste" then + tree.out(1).dims=A.dims + tree.out(1).dims(1)=A.dims(1)*m.value + if tree.out(1).dims(1)<0 then + tree.out(1).dims(1)=Unknown + end + tree.out(1).dims(2)=A.dims(2)*n.value + if tree.out(1).dims(2)<0 then + tree.out(1).dims(2)=Unknown + end + end + end + + if vtype==String then + tree=Funcall("asciimat",1,list(tree),tree.out); + tree.lhs(1).type=Type(String,Real) + elseif vtype==Boolean then + tree.out(1).type=Type(Boolean,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_reshape.bin b/modules/m2sci/macros/sci_files/sci_reshape.bin Binary files differnew file mode 100755 index 000000000..d45b91d91 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_reshape.bin diff --git a/modules/m2sci/macros/sci_files/sci_reshape.sci b/modules/m2sci/macros/sci_files/sci_reshape.sci new file mode 100755 index 000000000..dd06819dd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_reshape.sci @@ -0,0 +1,84 @@ +// 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]=sci_reshape(tree) + // M2SCI function + // Conversion function for Matlab reshape() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // knowndims is a boolean, it's true if all the dimensions of the lhs are known else it's false + // isemptyrhs is a boolean, it's true if one (or more than one) of the lhs dimensions it's equal to 0 else it's false + knowndims=%t + isemptyrhs=%f + for k=1:rhs + if k==1 then + if tree.rhs(k).vtype==String then + tree.rhs(k)=Funcall("mstr2sci",1,list(tree.rhs(k)),list(Variable("",tree.rhs(k).infer))) + elseif tree.rhs(k).vtype==Unknown then + scitree=tree + scitree.rhs(k)=Funcall("mtlb_double",1,list(tree.rhs(k)),list(Variable("",tree.rhs(k).infer))) + repl_poss(scitree,tree,tree.rhs(k),gettext("is not a character string matrix.")) + tree=scitree + end + end + if k>=2 then + for i=1:size(tree.rhs(k).dims) + if tree.rhs(k).dims(i)==-1 + knowndims=%f + end + end + end + if typeof(tree.rhs(k))=="cste" then + if isempty(tree.rhs(k).value) then + isemptyrhs=%t + tree.rhs(k)=Cste(-1) + end + end + end + + set_infos(gettext("WARNING: Matlab reshape() suppresses singleton higher dimension, it is not the case for matrix."),2) + tree.name="matrix" + tree.lhs(1).type=tree.rhs(1).type + if knowndims==%t + dims=list() + if size(tree.rhs)==2 + dims=lhsdimsearch(tree.rhs(2)) + tree.lhs(1).dims=dims + elseif size(tree.rhs)>=2 + if ~isemptyrhs then + for k=2:size(tree.rhs) + if typeof(tree.rhs(k)) == "cste" then + dims($+1)=tree.rhs(k).value + else + dims($+1) = Unknown; + end + end + tree.lhs(1).dims=dims + end + else + tree.lhs(1).dims=allunknown(tree.rhs(1).dims) + end + else + tree.lhs(1).dims=allunknown(tree.rhs(1).dims) + end +endfunction + +function dims=lhsdimsearch(rhs) + // LHSDIMSEARCH function searches dimensions size of the lhs + // dims : a list which contains the size of the lhs + if typeof(rhs)=="operation" then + dims=lstcat(rhs.operands(2).value,dims) + if typeof(rhs.operands(1))=="operation" then + dims=lhsdimsearch(rhs.operands(1)) + else + dims=lstcat(rhs.operands(1).value,dims) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_return.bin b/modules/m2sci/macros/sci_files/sci_return.bin Binary files differnew file mode 100755 index 000000000..c5ee632b3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_return.bin diff --git a/modules/m2sci/macros/sci_files/sci_return.sci b/modules/m2sci/macros/sci_files/sci_return.sci new file mode 100755 index 000000000..2331d5cee --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_return.sci @@ -0,0 +1,16 @@ +// 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]=sci_return(tree) + // M2SCI function + // Conversion function for Matlab return + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_round.bin b/modules/m2sci/macros/sci_files/sci_round.bin Binary files differnew file mode 100755 index 000000000..b34f7146d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_round.bin diff --git a/modules/m2sci/macros/sci_files/sci_round.sci b/modules/m2sci/macros/sci_files/sci_round.sci new file mode 100755 index 000000000..22a9a66fa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_round.sci @@ -0,0 +1,27 @@ +// 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]=sci_round(tree) + // File generated from sci_PROTO6.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab round() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_save.bin b/modules/m2sci/macros/sci_files/sci_save.bin Binary files differnew file mode 100755 index 000000000..adcbf6653 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_save.bin diff --git a/modules/m2sci/macros/sci_files/sci_save.sci b/modules/m2sci/macros/sci_files/sci_save.sci new file mode 100755 index 000000000..82ad49113 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_save.sci @@ -0,0 +1,32 @@ +// 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]=sci_save(tree) + // M2SCI function + // Conversion function for Matlab save() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="savematfile" + + // If no rhs, save Scilab environment + if rhs<=0 then + tree.rhs=Rhs_tlist("scilab.mat") + return + end + + for k=1:rhs + if typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-regexp" then + set_infos(gettext("Option -regexp not yet handled: will be ignored."),2); + elseif typeof(tree.rhs(k))=="cste" & tree.rhs(k).value=="-append" then + set_infos(gettext("Option -append not yet handled: will be ignored."),2); + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_schur.bin b/modules/m2sci/macros/sci_files/sci_schur.bin Binary files differnew file mode 100755 index 000000000..ea70d8045 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_schur.bin diff --git a/modules/m2sci/macros/sci_files/sci_schur.sci b/modules/m2sci/macros/sci_files/sci_schur.sci new file mode 100755 index 000000000..4e1b377cb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_schur.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]=sci_schur(tree) + // M2SCI function + // Conversion function for Matlab schur() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + A = getrhs(tree) + // %c_schur and %b_schur are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=A.type + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_setstr.bin b/modules/m2sci/macros/sci_files/sci_setstr.bin Binary files differnew file mode 100755 index 000000000..f821c7428 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_setstr.bin diff --git a/modules/m2sci/macros/sci_files/sci_setstr.sci b/modules/m2sci/macros/sci_files/sci_setstr.sci new file mode 100755 index 000000000..766571bca --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_setstr.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 [tree]=sci_setstr(tree) + // M2SCI function + // Conversion function for Matlab setstr() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_setstr() + + X = getrhs(tree) + + if X.vtype==String then + set_infos(msprintf(gettext("In %s %s is a String,\nSo result is set to %s."),expression2code(tree),expression2code(X),expression2code(X)),0) + // Because of String concatenation + if typeof(X)=="operation" then + X.out(1)=tree.lhs(1) + elseif typeof(X)=="funcall" then + X.lhs(1)=tree.lhs(1) + end + tree=X + elseif X.vtype==Unknown then + tree.name="mtlb_setstr" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + else + tree.name="ascii" + if X.dims(1)==1 | is_a_scalar(X) then // Row vector or scalar + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + else + tree.name="mtlb_setstr" + tree.lhs(1).dims=X.dims + tree.lhs(1).type=Type(String,Real) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sign.bin b/modules/m2sci/macros/sci_files/sci_sign.bin Binary files differnew file mode 100755 index 000000000..d3e95a026 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sign.bin diff --git a/modules/m2sci/macros/sci_files/sci_sign.sci b/modules/m2sci/macros/sci_files/sci_sign.sci new file mode 100755 index 000000000..dae4becff --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sign.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]=sci_sign(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sign() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sign" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sin.bin b/modules/m2sci/macros/sci_files/sci_sin.bin Binary files differnew file mode 100755 index 000000000..d050b387c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sin.bin diff --git a/modules/m2sci/macros/sci_files/sci_sin.sci b/modules/m2sci/macros/sci_files/sci_sin.sci new file mode 100755 index 000000000..0e1fb2bf6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sin.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]=sci_sin(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sin() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sin" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sinh.bin b/modules/m2sci/macros/sci_files/sci_sinh.bin Binary files differnew file mode 100755 index 000000000..11942d99b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sinh.bin diff --git a/modules/m2sci/macros/sci_files/sci_sinh.sci b/modules/m2sci/macros/sci_files/sci_sinh.sci new file mode 100755 index 000000000..fd79df1cc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sinh.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]=sci_sinh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sinh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sinh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_size.bin b/modules/m2sci/macros/sci_files/sci_size.bin Binary files differnew file mode 100755 index 000000000..8997ce5dc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_size.bin diff --git a/modules/m2sci/macros/sci_files/sci_size.sci b/modules/m2sci/macros/sci_files/sci_size.sci new file mode 100755 index 000000000..620be408d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_size.sci @@ -0,0 +1,73 @@ +// 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]=sci_size(tree) + // M2SCI function + // Conversion function for Matlab size() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_size() + + // In Matlab : size('str1') = [1 4] but in Scilab : size('str1') = [1 1] + // so we convert expr to ascii code matrix which have good size + + + // m = size(X,dim) (If two inputs, then only one output) + if rhs==2 then + [X,dim]=getrhs(tree) + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + end + tree.rhs=Rhs_tlist(X,dim) + + // Matlab can work with dim > size(size(X),2) but not Scilab + if typeof(dim)=="cste" then + if dim.value>size(X.dims) then + set_infos(msprintf(gettext("M2SCI found: %s > size(size(%s),2),\nSo result is set to 1."),expression2code(dim),expression2code(X)),0) + tree=Cste(1) + else + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + else + tree=Funcall("mtlb_size",1,list(X,dim),tree.lhs) + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + end + + // [d1,d2,d3,...,dn] = size(X) + else + X = getrhs(tree) + if or(X.vtype==[String,Unknown]) then + X = convert2double(X) + end + tree.rhs=Rhs_tlist(X) + + // d1 = size(X) + if lhs==1 then + tree.lhs(1).dims=list(1,size(X.dims)) + tree.lhs(1).type=Type(Double,Real) + + // [d1,d2,d3,...,dn] = size(X) + else + if size(tree.lhs)<size(X.dims) then + // Number of outputs is less than size(size(X),2) so mtlb_size() is called + tree=Funcall("mtlb_size",size(tree.lhs),list(X),tree.lhs) + end + if size(tree.lhs)>size(X.dims) then + // Number of outputs is greater than size(size(X),2) so mtlb_size() is called + tree=Funcall("mtlb_size",size(tree.lhs),list(X),tree.lhs) + end + for klhs=1:size(tree.lhs) + tree.lhs(klhs).dims=list(1,1) + tree.lhs(klhs).type=Type(Double,Real) + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sort.bin b/modules/m2sci/macros/sci_files/sci_sort.bin Binary files differnew file mode 100755 index 000000000..a844166eb --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sort.bin diff --git a/modules/m2sci/macros/sci_files/sci_sort.sci b/modules/m2sci/macros/sci_files/sci_sort.sci new file mode 100755 index 000000000..adb7e2ab1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sort.sci @@ -0,0 +1,138 @@ +// 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]=sci_sort(tree) + // M2SCI function + // Conversion function for Matlab sort() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_sort() + + // B = sort(A) or [B,IND] = sort(A) + if rhs==1 then + A = getrhs(tree) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if or(A.vtype==[String,Unknown]) then + tree.name="mtlb_sort" + elseif A.vtype==Boolean then + tree.name="gsort" + if is_a_vector(A) then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,"g","i") + elseif not_a_vector(A) then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,"r","i") + else + tree.name="mtlb_sort" + end + else + tree.name="gsort" + if is_a_vector(A) then + tree.rhs=Rhs_tlist(A,"g","i") + elseif not_a_vector(A) then + tree.rhs=Rhs_tlist(A,"r","i") + else + tree.name="mtlb_sort" + end + end + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + // B = sort(A,dim) or [B,IND] = sort(A,dim) + elseif rhs==2 + [A,dim] = getrhs(tree) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if size(A.dims)>2 then + set_infos(gettext("Scilab sort() and gsort() do not work with multidimensional arrays")) + else + name="gsort" + if typeof(dim)=="cste" then + if dim.value==1 then + dim=Cste("r") + elseif dim.value==2 then + dim=Cste("c") + else + name="mtlb_sort" + end + else + name="mtlb_sort" + end + + if or(A.vtype==[String,Unknown]) then + name="mtlb_sort" + elseif A.vtype==Boolean then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs=Rhs_tlist(A,dim,"i") + else + tree.rhs=Rhs_tlist(A,dim,"i") + end + tree.name=name + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + end + elseif rhs==3 + [A,dim,txt] = getrhs(tree) + dim = convert2double(dim) + tree.rhs=Rhs_tlist(A,dim,txt) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + + if size(A.dims)>2 then + set_infos(gettext("Scilab sort() and gsort() do not work with multidimensional arrays")) + else + name="gsort" + if typeof(dim)=="cste" then + if dim.value==1 then + dim=Cste("r") + elseif dim.value==2 then + dim=Cste("c") + else + name="mtlb_sort" + end + else + name="mtlb_sort" + end + if or(A.vtype==[String,Unknown]) then + name="mtlb_sort" + elseif A.vtype==Boolean then + A = Funcall("bool2s",1,Rhs_tlist(A),list()) + tree.rhs(1)=A + end + + if txt.vtype==String & txt.value=="ascend" + tree.rhs=Rhs_tlist(A,dim,"i") + elseif txt.vtype==String & txt.value=="descend" + tree.rhs=Rhs_tlist(A,dim,"d") + else + name="mtlb_sort" + end + tree.name=name + + if lhs==2 then + tree.lhs(2).dims=A.dims + tree.lhs(2).type=Type(Double,Real) + end + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sortrows.bin b/modules/m2sci/macros/sci_files/sci_sortrows.bin Binary files differnew file mode 100755 index 000000000..1e1b00b25 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sortrows.bin diff --git a/modules/m2sci/macros/sci_files/sci_sortrows.sci b/modules/m2sci/macros/sci_files/sci_sortrows.sci new file mode 100755 index 000000000..c9384f856 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sortrows.sci @@ -0,0 +1,35 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_sortrows(tree) + // M2SCI function + // Conversion function for Matlab sortrows() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + if size(tree.rhs)==1 then + if tree.rhs(1).vtype==4 + tree.rhs(1)=convert2double(tree.rhs(1)) + tree=Funcall("gsort",1,list(tree.rhs(1),Cste("lr"),Cste("i")),list(tree.lhs(:))) + elseif tree.rhs(1).vtype==Unknown + tree=Funcall("mtlb_sortrows",1,list(tree.rhs(1)),list(tree.lhs(:))) + else + tree=Funcall("gsort",1,list(tree.rhs(1),Cste("lr"),Cste("i")),list(tree.lhs(:))) + end + tree.lhs(1).infer=tree.rhs(1).infer + elseif size(tree.rhs)==2 then + tree=Funcall("mtlb_sortrows",1,list(tree.rhs(1),tree.rhs(2)),list(tree.lhs(:))) + end + + if size(tree.lhs)==2 then + tree.lhs(2).dims=list(tree.rhs(1).dims(1),1) + tree.lhs(2).type=Type(1,Real) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sparse.bin b/modules/m2sci/macros/sci_files/sci_sparse.bin Binary files differnew file mode 100755 index 000000000..0734b0c06 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sparse.bin diff --git a/modules/m2sci/macros/sci_files/sci_sparse.sci b/modules/m2sci/macros/sci_files/sci_sparse.sci new file mode 100755 index 000000000..8ed4d22bf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sparse.sci @@ -0,0 +1,126 @@ +// 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]=sci_sparse(tree) + // M2SCI function + // Conversion function for Matlab sparse() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // nzmax does not exist in Scilab + if rhs==6 then + rhs=5 + set_infos(gettext("Call to sparse(): nzmax option ignored."),0) + end + + // S = sparse(A) + if rhs==1 then + A = getrhs(tree) + // %c_sparse and %b_sparse are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=Type(Sparse,A.property) + + // S = sparse(m,n) + elseif rhs==2 then + [m,n] = getrhs(tree) + // %c_sparse and %b_sparse are not defined + m = convert2double(m) + n = convert2double(n) + tree.rhs=Rhs_tlist([],[],Operation("rc",list(m,n),list())) + + dims=list(Unknown,Unknown) + if typeof(m)=="cste" then + dims(1)=m.value + end + if typeof(n)=="cste" then + dims(2)=n.value + end + tree.lhs(1).dims=dims + tree.lhs(1).type=Type(Sparse,Real) + + // S = sparse(i,j,s) + elseif rhs==3 then + [i,j,s] = getrhs(tree) + // %c_sparse and %b_sparse are not defined + i = convert2double(i) + j = convert2double(j) + s = convert2double(s) + tree.rhs=Rhs_tlist(i,j,s) + + // Matlab tolerates length(i)<>length(j)... + if size(i.dims)<>size(j.dims) | size(i.dims)<>size(s.dims) then + set_infos(gettext("For Scilab sparse(), input values must have the same size, not sure they have."),2) + end + + if i.dims(2)==1 & j.dims(2)==1 then + tree.rhs=Rhs_tlist(Operation("rc",list(i,j),list()),s) + elseif typeof(i)=="variable" & typeof(j)=="variable" then + tree.rhs=Rhs_tlist(Operation("rc",list(Operation("ext",list(i,Cste(":")),list()),Operation("ext",list(j,Cste(":")),list())),list()),s) + else + if typeof(i)<>"variable" then + V1=gettempvar(1) + insert(Equal(list(V1),i)) + else + V1=i + end + if typeof(j)<>"variable" then + V2=gettempvar(2) + insert(Equal(list(V2),j)) + else + V2=j + end + tree.rhs=Rhs_tlist(Operation("rc",list(Operation("ext",list(V1,Cste(":")),list()),Operation("ext",list(V2,Cste(":")),list())),list()),s) + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Sparse,s.property) + elseif rhs==4 then + // Can not happen + //S = sparse(i,j,s,m,n) + elseif rhs==5 then + + [i,j,s,m,n] = getrhs(tree) + i = convert2double(i) + j = convert2double(j) + s = convert2double(s) + m = convert2double(m) + n = convert2double(n) + + tree.rhs=Rhs_tlist(i,j,s,m,n) + + if i.dims(2)==1 & j.dims(2)=="1" then + tree.rhs=Rhs_tlist(Operation("rc",list(i,j),list()),s) + elseif typeof(i)=="variable" & typeof(j)=="variable" then + rhs1=Operation("rc",list(Operation("ext",list(i,Cste(":")),list()),Operation("ext",list(j,Cste(":")),list())),list()) + rhs3=Operation("rc",list(m,n),list()) + tree.rhs=Rhs_tlist(rhs1,s,rhs3) + else + if typeof(i)<>"variable" then + V1=gettempvar(1) + insert(Equal(list(V1),i)) + else + V1=i + end + if typeof(j)<>"variable" then + V2=gettempvar(2) + insert(Equal(list(V2),j)) + else + V2=j + end + rhs1=Operation("rc",list(Operation("ext",list(V1,Cste(":")),list()),Operation("ext",list(V2,Cste(":")),list())),list()) + rhs3=Operation("rc",list(m,n),list()) + tree.rhs=Rhs_tlist(rhs1,s,rhs3) + end + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Sparse,s.property) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sqrt.bin b/modules/m2sci/macros/sci_files/sci_sqrt.bin Binary files differnew file mode 100755 index 000000000..94a33d2fe --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sqrt.bin diff --git a/modules/m2sci/macros/sci_files/sci_sqrt.sci b/modules/m2sci/macros/sci_files/sci_sqrt.sci new file mode 100755 index 000000000..93eacf4d3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sqrt.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]=sci_sqrt(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sqrt() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="sqrt" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_str2num.bin b/modules/m2sci/macros/sci_files/sci_str2num.bin Binary files differnew file mode 100755 index 000000000..8368aed55 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_str2num.bin diff --git a/modules/m2sci/macros/sci_files/sci_str2num.sci b/modules/m2sci/macros/sci_files/sci_str2num.sci new file mode 100755 index 000000000..c50c27295 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_str2num.sci @@ -0,0 +1,18 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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]=sci_str2num(tree) + // M2SCI function + // Conversion function for Matlab str2num() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="evstr" + tree.lhs(1).type=Type(Double,Real) +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_strcmp.bin b/modules/m2sci/macros/sci_files/sci_strcmp.bin Binary files differnew file mode 100755 index 000000000..86ba2e7af --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmp.bin diff --git a/modules/m2sci/macros/sci_files/sci_strcmp.sci b/modules/m2sci/macros/sci_files/sci_strcmp.sci new file mode 100755 index 000000000..c7ba87778 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmp.sci @@ -0,0 +1,31 @@ +// 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]=sci_strcmp(tree) + // M2SCI function + // Conversion function for Matlab strcmp() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strcmp() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + tree = Operation("==",list(A,B),tree.lhs) + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + elseif A.vtype<>Unknown & B.vtype<>Unknown then + // At least one argument is not a character string matrix in call of strcmp() so result is set to 0 + tree = Cste(%F) + else + tree.name="mtlb_strcmp" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strcmpi.bin b/modules/m2sci/macros/sci_files/sci_strcmpi.bin Binary files differnew file mode 100755 index 000000000..f9d94709f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmpi.bin diff --git a/modules/m2sci/macros/sci_files/sci_strcmpi.sci b/modules/m2sci/macros/sci_files/sci_strcmpi.sci new file mode 100755 index 000000000..3f76894b1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strcmpi.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]=sci_strcmpi(tree) + // M2SCI function + // Conversion function for Matlab strcmpi() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strcmpi() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + A = Funcall("convstr",1,Rhs_tlist(A),list()) + B = Funcall("convstr",1,Rhs_tlist(B),list()) + tree = Operation("==",list(A,B),tree.lhs) + tree.out(1).dims=list(1,1) + tree.out(1).type=Type(Boolean,Real) + elseif A.vtype<>Unknown & B.vtype<>Unknown then + // At least one argument is not a character string matrix in call of strcmpi() so result is set to 0 + tree = Cste(%F) + else + tree.name="mtlb_strcmpi" + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Boolean,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strfind.bin b/modules/m2sci/macros/sci_files/sci_strfind.bin Binary files differnew file mode 100755 index 000000000..37538f0e1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strfind.bin diff --git a/modules/m2sci/macros/sci_files/sci_strfind.sci b/modules/m2sci/macros/sci_files/sci_strfind.sci new file mode 100755 index 000000000..6b1e6c0d2 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strfind.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]=sci_strfind(tree) + // M2SCI function + // Conversion function for Matlab strfind() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strfind() + + [A,B] = getrhs(tree) + + if A.vtype==String & B.vtype==String then + tree.name="strindex" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + else + tree.name="mtlb_strfind" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_strrep.bin b/modules/m2sci/macros/sci_files/sci_strrep.bin Binary files differnew file mode 100755 index 000000000..67a04683e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strrep.bin diff --git a/modules/m2sci/macros/sci_files/sci_strrep.sci b/modules/m2sci/macros/sci_files/sci_strrep.sci new file mode 100755 index 000000000..818e7a08b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_strrep.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]=sci_strrep(tree) + // M2SCI function + // Conversion function for Matlab strrep() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_strrep() + + [s1,s2,s3] = getrhs(tree) + + if s1.vtype==String & s2.vtype==String & s3.vtype==String then + tree.name="strsubst" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + else + tree.name="mtlb_strrep" + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Unknown,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_struct.bin b/modules/m2sci/macros/sci_files/sci_struct.bin Binary files differnew file mode 100755 index 000000000..a5943b4b8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_struct.bin diff --git a/modules/m2sci/macros/sci_files/sci_struct.sci b/modules/m2sci/macros/sci_files/sci_struct.sci new file mode 100755 index 000000000..e10d38414 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_struct.sci @@ -0,0 +1,81 @@ +// 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]=sci_struct(tree) + // M2SCI function + // Conversion function for Matlab struct() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).type=Type(Struct,Unknown) + + // Dims... + dims=tree.rhs(2).dims + for k=4:2:rhs + for l=1:lstsize(dims) + if tree.rhs(k).dims(l)==Unknown then + dims(l)=Unknown + else + if dims(l)<>Unknown then + if dims(l)<tree.rhs(k).dims(l) then + dims(l)=tree.rhs(k).dims(l) + end + end + end + + end + end + + tree.lhs(1).dims=dims + + // Update contents + dims=[0 0] + allnotcells=%T + for k=1:2:rhs + allnotcells=allnotcells & tree.rhs(k+1).vtype<>Cell + end + if allnotcells then + dims=[1 1] + tree.lhs(1).dims=list(1,1) + else + for k=1:2:rhs + if tree.rhs(k+1).vtype==Cell then + if double(tree.rhs(k+1).dims(1))>dims(1) then + dims(1)=double(tree.rhs(k+1).dims(1)) + end + if double(tree.rhs(k+1).dims(2))>dims(2) then + dims(2)=double(tree.rhs(k+1).dims(2)) + end + end + end + end + + for k=1:2:rhs + dim1=dims(1) + dim2=dims(2) + for kd1=1:dims(1) + for kd2=1:dims(2) + if tree.rhs(k+1).vtype==Cell then + + if tree.rhs(k+1).dims(1)*tree.rhs(k+1).dims(2)<>1 then + tree.lhs(1).contents.index($+1)=list(list(Cste(kd1),Cste(kd2)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=get_contents_infer(tree.rhs(k+1),list(list(Cste(kd1),Cste(kd2)),Cste("entries"))) + else + tree.lhs(1).contents.index($+1)=list(list(Cste(kd1),Cste(kd2)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=get_contents_infer(tree.rhs(k+1),list(list(Cste(1),Cste(1)),Cste("entries"))) + end + + else + tree.lhs(1).contents.index($+1)=list(list(Cste(1),Cste(1)),tree.rhs(k)) + tree.lhs(1).contents.data($+1)=tree.rhs(k+1).infer + end + end + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_subplot.bin b/modules/m2sci/macros/sci_files/sci_subplot.bin Binary files differnew file mode 100755 index 000000000..3f43db1e4 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_subplot.bin diff --git a/modules/m2sci/macros/sci_files/sci_subplot.sci b/modules/m2sci/macros/sci_files/sci_subplot.sci new file mode 100755 index 000000000..49a8c27ed --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_subplot.sci @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA - Serge STEER +// +// 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]=sci_subplot(tree) + // M2SCI function + // Conversion function for Matlab tic + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_sum.bin b/modules/m2sci/macros/sci_files/sci_sum.bin Binary files differnew file mode 100755 index 000000000..a54652213 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sum.bin diff --git a/modules/m2sci/macros/sci_files/sci_sum.sci b/modules/m2sci/macros/sci_files/sci_sum.sci new file mode 100755 index 000000000..7221fb027 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_sum.sci @@ -0,0 +1,82 @@ +// 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]=sci_sum(tree) + // File generated from sci_PROTO8.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab sum() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_sum() + + // B = sum(A) + if rhs==1 then + A = getrhs(tree) + + // Because %b_sum and %C_sum are not defined + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + + if is_a_vector(A) | is_empty(A) then + tree.lhs(1).dims=list(1,1) + elseif not_a_vector(A) then + tree.lhs(1).dims=list(1,A.dims(2)) + tree.rhs=Rhs_tlist(A,1) + elseif not_empty(A) then + dim = first_non_singleton(A) + if dim>0 then + tree.rhs=Rhs_tlist(A,dim) + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim)=1 + else + tree.rhs=Rhs_tlist(A,Funcall("firstnonsingleton",1,list(A),list())) + tree.lhs(1).dims=allunknown(A.dims) + end + else + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + end + + // B = sum(A,dim) + else + [A,dim] = getrhs(tree) + + // Because %b_sum and %C_sum are not defined + A=convert2double(A) + dim=convert2double(dim) + tree.rhs=Rhs_tlist(A,dim) + + + if typeof(dim)=="cste" then + if dim.value>size(A.dims) then + // Scilab sum() does not work when dim is greater than number of dims A + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + else + tree.lhs(1).dims=A.dims + tree.lhs(1).dims(dim.value)=1 + end + else + tree.name="mtlb_sum" + tree.lhs(1).dims=allunknown(A.dims) + end + + if is_real(A) then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_surf.bin b/modules/m2sci/macros/sci_files/sci_surf.bin Binary files differnew file mode 100755 index 000000000..a7e4343ef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_surf.bin diff --git a/modules/m2sci/macros/sci_files/sci_surf.sci b/modules/m2sci/macros/sci_files/sci_surf.sci new file mode 100755 index 000000000..c3502f1e7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_surf.sci @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_surf(tree) + // M2SCI function + // Conversion function for Matlab surf() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if tree.lhs(1).name <> "ans" then + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("gce",1,list(),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + else + tree.lhs(1).type=Type(Handle,Unknown) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_svd.bin b/modules/m2sci/macros/sci_files/sci_svd.bin Binary files differnew file mode 100755 index 000000000..1bd726756 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_svd.bin diff --git a/modules/m2sci/macros/sci_files/sci_svd.sci b/modules/m2sci/macros/sci_files/sci_svd.sci new file mode 100755 index 000000000..628ec27e5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_svd.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]=sci_svd(tree) + // M2SCI function + // Conversion function for Matlab svd() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // svd(X) + if rhs==1 then + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A) + // svd(A,0) + else + A = getrhs(tree) + A = convert2double(A) + tree.rhs=Rhs_tlist(A,"e") + end + + tree.lhs(1).dims=list(Unknown,1) + tree.lhs(1).type=Type(Double,Real) + if lhs>1 then + tree.lhs(2).dims=list(Unknown,Unknown) + tree.lhs(2).type=A.type + end + if lhs>2 then + tree.lhs(3).dims=list(Unknown,Unknown) + tree.lhs(3).type=Type(Double,Unknown) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tan.bin b/modules/m2sci/macros/sci_files/sci_tan.bin Binary files differnew file mode 100755 index 000000000..8e39a6485 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tan.bin diff --git a/modules/m2sci/macros/sci_files/sci_tan.sci b/modules/m2sci/macros/sci_files/sci_tan.sci new file mode 100755 index 000000000..3dc49705d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tan.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]=sci_tan(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tan() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="tan" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tanh.bin b/modules/m2sci/macros/sci_files/sci_tanh.bin Binary files differnew file mode 100755 index 000000000..89b42e38b --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tanh.bin diff --git a/modules/m2sci/macros/sci_files/sci_tanh.sci b/modules/m2sci/macros/sci_files/sci_tanh.sci new file mode 100755 index 000000000..9f6748a04 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tanh.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]=sci_tanh(tree) + // File generated from sci_PROTO4.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tanh() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + tree.name="tanh" + + A=getrhs(tree) + A=convert2double(A) + tree.rhs=Rhs_tlist(A) + + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tic.bin b/modules/m2sci/macros/sci_files/sci_tic.bin Binary files differnew file mode 100755 index 000000000..def989292 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tic.bin diff --git a/modules/m2sci/macros/sci_files/sci_tic.sci b/modules/m2sci/macros/sci_files/sci_tic.sci new file mode 100755 index 000000000..c7cc9b4c8 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tic.sci @@ -0,0 +1,16 @@ +// 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]=sci_tic(tree) + // M2SCI function + // Conversion function for Matlab tic + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_title.bin b/modules/m2sci/macros/sci_files/sci_title.bin Binary files differnew file mode 100755 index 000000000..e1118ab3f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_title.bin diff --git a/modules/m2sci/macros/sci_files/sci_title.sci b/modules/m2sci/macros/sci_files/sci_title.sci new file mode 100755 index 000000000..0dee821ef --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_title.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_title(tree) + // M2SCI function + // Conversion function for Matlab title() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""title"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_toc.bin b/modules/m2sci/macros/sci_files/sci_toc.bin Binary files differnew file mode 100755 index 000000000..ac0c3118d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toc.bin diff --git a/modules/m2sci/macros/sci_files/sci_toc.sci b/modules/m2sci/macros/sci_files/sci_toc.sci new file mode 100755 index 000000000..d9e433cfa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toc.sci @@ -0,0 +1,18 @@ +// 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]=sci_toc(tree) + // M2SCI function + // Conversion function for Matlab toc + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_toeplitz.bin b/modules/m2sci/macros/sci_files/sci_toeplitz.bin Binary files differnew file mode 100755 index 000000000..45976425a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toeplitz.bin diff --git a/modules/m2sci/macros/sci_files/sci_toeplitz.sci b/modules/m2sci/macros/sci_files/sci_toeplitz.sci new file mode 100755 index 000000000..b4e5b20e6 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_toeplitz.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]=sci_toeplitz(tree) + // M2SCI function + // Conversion function for Matlab toeplitz() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // T = toeplitz(c) + if rhs==1 then + c=tree.rhs(1) + if c.property<>Real then + tree.name="mtlb_toeplitz" + elseif ~is_a_vector(c) & ~is_a_scalar(c) then + tree.name="mtlb_toeplitz" + end + tree.rhs(1)=c + tree.lhs(1).type=Type(Double,c.property) + // T = toeplitz(c,r) + else + [c,r]=getrhs(tree) + tree.rhs=Rhs_tlist(c, r) + tree.name="mtlb_toeplitz" + if c.property==Complex | r.property==Complex then + tree.lhs(1).type=Type(Double,Complex) + elseif c.property==Real | r.property==Real then + tree.lhs(1).type=Type(Double,Real) + else + tree.lhs(1).type=Type(Double,Unknown) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_tril.bin b/modules/m2sci/macros/sci_files/sci_tril.bin Binary files differnew file mode 100755 index 000000000..ee7b88cc5 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tril.bin diff --git a/modules/m2sci/macros/sci_files/sci_tril.sci b/modules/m2sci/macros/sci_files/sci_tril.sci new file mode 100755 index 000000000..4dcae6faf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_tril.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]=sci_tril(tree) + // File generated from sci_PROTO7.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab tril() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_tril() + + // L = tril(X,k) + if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) + // L = tril(X) + else + X = getrhs(tree) + end + + // Common part + if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_tril" + else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end + end + + if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type + else + tree.lhs(1).type=Type(X.vtype,Unknown) + end + tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_triu.bin b/modules/m2sci/macros/sci_files/sci_triu.bin Binary files differnew file mode 100755 index 000000000..0acb7208f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_triu.bin diff --git a/modules/m2sci/macros/sci_files/sci_triu.sci b/modules/m2sci/macros/sci_files/sci_triu.sci new file mode 100755 index 000000000..7fa409d19 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_triu.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]=sci_triu(tree) + // File generated from sci_PROTO7.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab triu() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_triu() + + // L = triu(X,k) + if rhs==2 then + [X,k] = getrhs(tree) + // Convert k to double + k=convert2double(k) + tree.rhs=Rhs_tlist(X,k) + // L = triu(X) + else + X = getrhs(tree) + end + + // Common part + if or(X.vtype==[String,Unknown]) then + tree.name="mtlb_triu" + else + if X.vtype==Boolean then + X=Funcall("bool2s",1,Rhs_tlist(X),list(Variable("",X.infer))) + tree.rhs(1)=X + end + end + + if isempty(strindex(tree.name,"triu")) then + tree.lhs(1).type=X.type + else + tree.lhs(1).type=Type(X.vtype,Unknown) + end + tree.lhs(1).dims=X.dims + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_true.bin b/modules/m2sci/macros/sci_files/sci_true.bin Binary files differnew file mode 100755 index 000000000..c0f0ddc86 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_true.bin diff --git a/modules/m2sci/macros/sci_files/sci_true.sci b/modules/m2sci/macros/sci_files/sci_true.sci new file mode 100755 index 000000000..138a1aa4c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_true.sci @@ -0,0 +1,176 @@ +// 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]=sci_true(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab true() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_true() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // true(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("ones",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // true([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("ones",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // true(n) or true([n1,n2,...]) ? + else + tree.name="mtlb_true" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // true(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="ones" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_type.bin b/modules/m2sci/macros/sci_files/sci_type.bin Binary files differnew file mode 100755 index 000000000..76653c648 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_type.bin diff --git a/modules/m2sci/macros/sci_files/sci_type.sci b/modules/m2sci/macros/sci_files/sci_type.sci new file mode 100755 index 000000000..aa3bb326e --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_type.sci @@ -0,0 +1,20 @@ +// 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]=sci_type(tree) + // M2SCI function + // Conversion function for Matlab type() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + // Emulation function: mtlb_type() + + set_infos(msprintf(gettext("No simple equivalent, so %s() is called."),"mtlb_type"),0); + tree.name="mtlb_type" + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uigetdir.bin b/modules/m2sci/macros/sci_files/sci_uigetdir.bin Binary files differnew file mode 100755 index 000000000..145041410 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uigetdir.bin diff --git a/modules/m2sci/macros/sci_files/sci_uigetdir.sci b/modules/m2sci/macros/sci_files/sci_uigetdir.sci new file mode 100755 index 000000000..f83befeb0 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uigetdir.sci @@ -0,0 +1,21 @@ +// 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]=sci_uigetdir(tree) + // M2SCI function + // Conversion function for Matlab uigetdir() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + tree.name="uigetdir" + + tree.lhs(1).dims=list(1,Unknown) + tree.lhs(1).type=Type(String,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint16.bin b/modules/m2sci/macros/sci_files/sci_uint16.bin Binary files differnew file mode 100755 index 000000000..51f5c1b42 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint16.bin diff --git a/modules/m2sci/macros/sci_files/sci_uint16.sci b/modules/m2sci/macros/sci_files/sci_uint16.sci new file mode 100755 index 000000000..fc0d473d9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint16.sci @@ -0,0 +1,55 @@ +// 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]=sci_uint16(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint16() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint16() + + // %c_uint16 and %b_uint16 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint16() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint16","uint16"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint16","uint16"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint16" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint32.bin b/modules/m2sci/macros/sci_files/sci_uint32.bin Binary files differnew file mode 100755 index 000000000..b5f5ad71f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint32.bin diff --git a/modules/m2sci/macros/sci_files/sci_uint32.sci b/modules/m2sci/macros/sci_files/sci_uint32.sci new file mode 100755 index 000000000..dc056d9e3 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint32.sci @@ -0,0 +1,55 @@ +// 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]=sci_uint32(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint32() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint32() + + // %c_uint32 and %b_uint32 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint32() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint32","uint32"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint32","uint32"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint32" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_uint8.bin b/modules/m2sci/macros/sci_files/sci_uint8.bin Binary files differnew file mode 100755 index 000000000..fc022cb22 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint8.bin diff --git a/modules/m2sci/macros/sci_files/sci_uint8.sci b/modules/m2sci/macros/sci_files/sci_uint8.sci new file mode 100755 index 000000000..6c2ca635d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_uint8.sci @@ -0,0 +1,55 @@ +// 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]=sci_uint8(tree) + // File generated from sci_PROTO9.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab uint8() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_uint8() + + // %c_uint8 and %b_uint8 are not defined in Scilab + x = getrhs(tree) + + // Matlab uint8() can return Boolean type value + if or(x.vtype==[Boolean,Unknown]) then + vtype=Unknown + else + vtype=Int + end + + x = convert2double(x) + + tree.rhs=Rhs_tlist(x) + + if is_complex(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint8","uint8"),2); + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + elseif ~is_real(x) then + set_infos(msprintf(gettext("Scilab %s() does not work with Complex values: %s() call IGNORED."),"uint8","uint8"),2); + repl_poss(x,tree,x,gettext("is Real.")) + if typeof(x)=="operation" then + x.out=tree.lhs + elseif typeof(x)=="funcall" then + x.lhs=tree.lhs + end + tree=x + else + tree.name="mtlb_uint8" + tree.lhs(1).dims=x.dims + tree.lhs(1).type=x.type + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_unix.bin b/modules/m2sci/macros/sci_files/sci_unix.bin Binary files differnew file mode 100755 index 000000000..44c5426f9 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_unix.bin diff --git a/modules/m2sci/macros/sci_files/sci_unix.sci b/modules/m2sci/macros/sci_files/sci_unix.sci new file mode 100755 index 000000000..dc9ae4309 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_unix.sci @@ -0,0 +1,49 @@ +// 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]=sci_unix(tree) + // M2SCI function + // Conversion function for Matlab unix() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + if rhs==2 then + tree.rhs(2)=null() + end + + if lhs==1 then + V=gettempvar(2) + S=tree.lhs(1) + if S.name=="ans" then + S=gettempvar(1) + tree.lhs=list(V,S) + else + tree.lhs=list(V,S) + end + insert(Equal(tree.lhs,tree)) + tree=list() + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(S),list())),1) + end + else + tree.lhs=list(tree.lhs($:-1:1)) + + if rhs==2 then + insert(Equal(list(),Funcall("disp",1,list(tree.lhs(1),tree.lhs(2)),list())),1) + end + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(String,Real) + + tree.lhs(2).dims=list(1,1) + tree.lhs(2).type=Type(Double,Real) + + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_upper.bin b/modules/m2sci/macros/sci_files/sci_upper.bin Binary files differnew file mode 100755 index 000000000..3e57680bd --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_upper.bin diff --git a/modules/m2sci/macros/sci_files/sci_upper.sci b/modules/m2sci/macros/sci_files/sci_upper.sci new file mode 100755 index 000000000..75f7a3e5c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_upper.sci @@ -0,0 +1,37 @@ +// 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]=sci_upper(tree) + // M2SCI function + // Conversion function for Matlab upper() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_upper() + + opt=part("upper",1) + + A = getrhs(tree) + if A.vtype==String then + tree.name="convstr" + tree.rhs=Rhs_tlist(A,opt) + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + elseif A.vtype==Unknown then + tree.name="mtlb_upper" + tree.lhs(1).dims=A.dims + tree.lhs(1).type=A.type + else + if typeof(A)=="funcall" then + A.lhs=tree.lhs + elseif typeof(A)=="operation" then + A.out=tree.lhs + end + tree=A + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_vertcat.bin b/modules/m2sci/macros/sci_files/sci_vertcat.bin Binary files differnew file mode 100755 index 000000000..bdf613133 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_vertcat.bin diff --git a/modules/m2sci/macros/sci_files/sci_vertcat.sci b/modules/m2sci/macros/sci_files/sci_vertcat.sci new file mode 100755 index 000000000..1aa3d1915 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_vertcat.sci @@ -0,0 +1,64 @@ +// 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]=sci_vertcat(tree) + // M2SCI function + // Conversion function for Matlab vertcat() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + allargs=tree.rhs + out=tree.lhs + + tree=Operation("cc",list(allargs(1),allargs(2)),list()) + + // Create output + for k=3:rhs + tree=Operation("cc",list(tree,allargs(k)),list()) + end + tree.out=out + + // Dimensions + outdims=allargs(1).dims + for k=1:lstsize(outdims) + outdims(k)=Unknown + end + for k=1:rhs + for l=1:lstsize(allargs(k).dims) + if l<>1 & allargs(k).dims(l)<>Unknown then + outdims(l)=allargs(k).dims(l) + end + end + end + nbrows=0 + for k=1:rhs + if allargs(k).dims(1)<>Unknown then + nbrows=nbrows+allargs(k).dims(1) + else + nbrows=Unknown + break + end + end + outdims(1)=nbrows + + // Property + prop=Real + for k=1:rhs + if allargs(k).property==Complex then + prop=Complex + break + elseif allargs(k).property==Unknown then + prop=Unknown + break + end + end + + tree.out(1).dims=outdims + tree.out(1).type=Type(allargs(1).vtype,prop) +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin Binary files differnew file mode 100755 index 000000000..002f5090a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.bin diff --git a/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci new file mode 100755 index 000000000..28c108a8a --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_waitforbuttonpress.sci @@ -0,0 +1,31 @@ +// 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]=sci_waitforbuttonpress(tree) + // M2SCI function + // Conversion function for Matlab waitforbuttonpress() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + btn=gettempvar() + xc=gettempvar() + yc=gettempvar() + win=gettempvar() + str=gettempvar() + + insert(Equal(list(btn,xc,yc,win,str),Funcall("xclick",1,list(),list()))) + + comp=Operation(">",list(btn,Cste(64)),list()) + + tree=Funcall("bool2s",1,list(comp),tree.lhs) + + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_warning.bin b/modules/m2sci/macros/sci_files/sci_warning.bin Binary files differnew file mode 100755 index 000000000..e7bc30cbf --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_warning.bin diff --git a/modules/m2sci/macros/sci_files/sci_warning.sci b/modules/m2sci/macros/sci_files/sci_warning.sci new file mode 100755 index 000000000..aa2a6430d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_warning.sci @@ -0,0 +1,47 @@ +// 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]=sci_warning(tree) + // M2SCI function + // Conversion function for Matlab warning() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // warning + if rhs==0 then + // s = warning + if lhs==1 then + tree.rhs(1)=Cste("query") + // [s,f] = warning + else + insert(Equal(list(tree.lhs(2)),Cste("once"))) + tree.rhs(1)=Cste("query"); + tree.lhs(2)=null(); + end + elseif rhs<=2 then + if rhs==2 then + // First arg is a msg_id + set_infos(gettext("message_id ignored in following line."),2) + tree.rhs(1)=Cste(tree.rhs(1).value+" "+tree.rhs(2).value) + tree.rhs(2)=null() + end + + if typeof(tree.rhs(1))=="cste" & or(convstr(tree.rhs(1).value)==["""on""","""off""","""backtrace""","""debug""","""once""","""always"""]) then + if tree.lhs(1).name<>"ans" then + no_equiv(msprintf(gettext("%s: Output value set to ''on''."),expression2code(tree))) + tree=Cste("on") + else + no_equiv(expression2code(tree)) + end + end + // rhs >= 3 + else + no_equiv(expression2code(tree)) + end +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_who.bin b/modules/m2sci/macros/sci_files/sci_who.bin Binary files differnew file mode 100755 index 000000000..b95bf0a6c --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_who.bin diff --git a/modules/m2sci/macros/sci_files/sci_who.sci b/modules/m2sci/macros/sci_files/sci_who.sci new file mode 100755 index 000000000..603d9f361 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_who.sci @@ -0,0 +1,37 @@ +// 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]=sci_who(tree) + // M2SCI function + // Conversion function for Matlab who() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + k=1 + while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 + end + + if size(tree.rhs)==0 then + // Nothing to do + else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_whos.bin b/modules/m2sci/macros/sci_files/sci_whos.bin Binary files differnew file mode 100755 index 000000000..0fcb48415 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_whos.bin diff --git a/modules/m2sci/macros/sci_files/sci_whos.sci b/modules/m2sci/macros/sci_files/sci_whos.sci new file mode 100755 index 000000000..4a2feab00 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_whos.sci @@ -0,0 +1,37 @@ +// 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]=sci_whos(tree) + // M2SCI function + // Conversion function for Matlab whos() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + + k=1 + while k<=size(tree.rhs) + if tree.rhs(k).value=="" then + tree.rhs(k)=null() + end + k=k+1 + end + + if size(tree.rhs)==0 then + // Nothing to do + else + select tree.rhs(1).value + case "global" then + // Nothing to do + case "-file" then + no_equiv(expression2code(tree)) + else + no_equiv(expression2code(tree)) + end + end + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_winqueryreg.bin b/modules/m2sci/macros/sci_files/sci_winqueryreg.bin Binary files differnew file mode 100755 index 000000000..6acaff4dc --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_winqueryreg.bin diff --git a/modules/m2sci/macros/sci_files/sci_winqueryreg.sci b/modules/m2sci/macros/sci_files/sci_winqueryreg.sci new file mode 100755 index 000000000..9e14ca667 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_winqueryreg.sci @@ -0,0 +1,21 @@ +// 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]=sci_winqueryreg(tree) + // M2SCI function + // Conversion function for Matlab winqueryreg + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + // Matlab returns a Cell of strings or a int32 + // Scilab returns a matrix of strings or a int32 + tree.lhs(1).dims=list(Unknown,1); + tree.lhs(1).type=Type(Unknown,Real); + +endfunction diff --git a/modules/m2sci/macros/sci_files/sci_xlabel.bin b/modules/m2sci/macros/sci_files/sci_xlabel.bin Binary files differnew file mode 100755 index 000000000..b76452638 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_xlabel.bin diff --git a/modules/m2sci/macros/sci_files/sci_xlabel.sci b/modules/m2sci/macros/sci_files/sci_xlabel.sci new file mode 100755 index 000000000..28f47c90f --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_xlabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_xlabel(tree) + // M2SCI function + // Conversion function for Matlab xlabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""x_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_ylabel.bin b/modules/m2sci/macros/sci_files/sci_ylabel.bin Binary files differnew file mode 100755 index 000000000..5dd1ab5aa --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ylabel.bin diff --git a/modules/m2sci/macros/sci_files/sci_ylabel.sci b/modules/m2sci/macros/sci_files/sci_ylabel.sci new file mode 100755 index 000000000..021aa862d --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_ylabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_ylabel(tree) + // M2SCI function + // Conversion function for Matlab ylabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""y_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction
\ No newline at end of file diff --git a/modules/m2sci/macros/sci_files/sci_zeros.bin b/modules/m2sci/macros/sci_files/sci_zeros.bin Binary files differnew file mode 100755 index 000000000..b8f5ae2f7 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zeros.bin diff --git a/modules/m2sci/macros/sci_files/sci_zeros.sci b/modules/m2sci/macros/sci_files/sci_zeros.sci new file mode 100755 index 000000000..0ea7eac20 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zeros.sci @@ -0,0 +1,176 @@ +// 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]=sci_zeros(tree) + // File generated from sci_PROTO3.g: PLEASE DO NOT EDIT ! + // M2SCI function + // Conversion function for Matlab zeros() + // Input: tree = Matlab funcall tree + // Output: tree = Scilab equivalent for tree + // Emulation function: mtlb_zeros() + + // Used for false and true + name_sav=tree.name + + if rhs==-1 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(":") + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + if rhs==0 then + if tree.name=="ones"|tree.name=="eye" then + tree=Cste(1) + elseif tree.name=="zeros" then + tree=Cste(0) + elseif tree.name=="rand" then + // Nothing changed + elseif tree.name=="randn" then + tree.name="rand"; + tree.rhs=Rhs_tlist(1,1,"normal") + tree.lhs(1).dims=list(1,1) + tree.lhs(1).type=Type(Double,Real) + elseif tree.name=="false" then + tree=Cste(%F) + elseif tree.name=="true" then + tree=Cste(%T) + end + return + end + + // Special cases for rand and randn + if tree.name=="randn" |tree.name=="rand" then + if tree.rhs(1).vtype==String then // State + if rhs==1 then // Get the state + if tree.name=="rand" then + onescall=Funcall("ones",1,Rhs_tlist(35,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(35,1) + tree.out(1).type=Type(Double,Real) + else + onescall=Funcall("ones",1,Rhs_tlist(2,1),list()) + randcall=Funcall("rand",1,Rhs_tlist("seed"),list()) + tree=Operation("*",list(onescall,randcall),tree.lhs) + tree.out(1).dims=list(2,1) + tree.out(1).type=Type(Double,Real) + end + else // Set the state + tree=Funcall("rand",1,Rhs_tlist("seed",tree.rhs(2)),tree.lhs) + tree.lhs(1).dims=list(0,0) + tree.lhs(1).type=Type(Unknown,Unknown) + end + return + end + end + + opt=list(),if tree.name=="randn" then opt=Cste("normal"),end + + // zeros(n) + if rhs==1 then + n = getrhs(tree) + n=convert2double(n) + if is_a_scalar(n) then + if typeof(n)=="cste" then + dim=n.value + else + dim=Unknown + end + + tree=Funcall("zeros",1,Rhs_tlist(n,n,opt),tree.lhs) + tree.lhs(1).dims=list(dim,dim) + tree.lhs(1).type=Type(Double,Real) + // zeros([n1,n2,...]) + elseif not_a_scalar(n) + tmp=n + if typeof(n)<>"variable" then + tmp=gettempvar() + insert(Equal(list(tmp),n)) + end + newrhs=list() + for k=1:size(n.dims) + newrhs(k)=Operation("ext",list(tmp,Cste(k)),list()) + end + if opt<>list() then + newrhs($+1)=opt + end + tree=Funcall("zeros",1,newrhs,tree.lhs) + + // All dimensions are unknown because we can not compute them here... + tree.lhs(1).dims=list() + if opt<>list() then + for k=1:size(tree.rhs)-1 + tree.lhs(1).dims(k)=Unknown + end + else + for k=1:size(tree.rhs) + tree.lhs(1).dims(k)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + // zeros(n) or zeros([n1,n2,...]) ? + else + tree.name="mtlb_zeros" + + tree.lhs(1).dims=list(Unknown,Unknown) + tree.lhs(1).type=Type(Double,Real) + end + + // zeros(n1,n2,..) + else + for k=1:size(tree.rhs) + tree.rhs(k)=convert2double(tree.rhs(k)) + end + if opt<>list() then + tree.rhs($+1)=opt + end + tree.name="zeros" + // If one input is a Cste, we can infer corresponding dimension... + tree.lhs(1).dims=list() + for k=1:size(tree.rhs) + if typeof(tree.rhs(k))=="cste" then + if tree.rhs(k).value<>"normal" then + tree.lhs(1).dims($+1)=tree.rhs(k).value + end + else + tree.lhs(1).dims($+1)=Unknown + end + end + tree.lhs(1).type=Type(Double,Real) + end + + if or(name_sav==["false","true"]) then + if name_sav=="false" then + tree.name="zeros" + else + tree.name="ones" + end + tree.lhs(1).type=Type(Boolean,Real) + tree=Operation("==",list(tree,Cste(1)),tree.lhs) + end +endfunction + + + + + + diff --git a/modules/m2sci/macros/sci_files/sci_zlabel.bin b/modules/m2sci/macros/sci_files/sci_zlabel.bin Binary files differnew file mode 100755 index 000000000..98ed26ca1 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zlabel.bin diff --git a/modules/m2sci/macros/sci_files/sci_zlabel.sci b/modules/m2sci/macros/sci_files/sci_zlabel.sci new file mode 100755 index 000000000..b5d5bb563 --- /dev/null +++ b/modules/m2sci/macros/sci_files/sci_zlabel.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2004-2006 - INRIA - Farid BELAHCENE +// +// 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=sci_zlabel(tree) + // M2SCI function + // Conversion function for Matlab zlabel() + // Input: tree = Matlab funcall tree + // Ouput: tree = Scilab equivalent for tree + + global("m2sci_to_insert_a") + if typeof(tree.lhs(1))=="variable" & tree.lhs(1).name == "ans" then + tree.lhs(1).type=Type(Handle,Unknown) + else + m2sci_to_insert_a($+1)=list("EOL") + m2sci_to_insert_a($+1)=Equal(list(tree.lhs(1)),Funcall("get",1,list(Funcall("gca",1,list(),list()),"""z_label"""),list())) + tree.lhs(1)=Variable("ans",tlist(["infer","dims","type","contents"],list(1,1),Type(Handle,Unknown),Contents())) + end + +endfunction diff --git a/modules/m2sci/macros/translatepaths.bin b/modules/m2sci/macros/translatepaths.bin Binary files differnew file mode 100755 index 000000000..4ab22c6de --- /dev/null +++ b/modules/m2sci/macros/translatepaths.bin diff --git a/modules/m2sci/macros/translatepaths.sci b/modules/m2sci/macros/translatepaths.sci new file mode 100755 index 000000000..80c74512b --- /dev/null +++ b/modules/m2sci/macros/translatepaths.sci @@ -0,0 +1,218 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT +// Copyright (C) ???? - INRIA - Serge STEER +// +// 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 transorder=translatepaths(Paths,res_path) + // Perform translation of Matlab M-files to Scilab for all M-files found in Paths + + // Output : + // -transorder : a vector which contains the files names with a determinated order + // Input : + // -Paths : a vector of strings (paths of Matlab M-files to translate) + // -res_paths : a string (resolution path of translated files) + + // M2SCI kernel functions called: + // -lst_funcall + // -translateorder + // - mfile2sci + + // Get default arguments + + [lhs,rhs]=argn(0) + if rhs<2 then res_path="./",end + if rhs<1 then m2sci_gui();transorder=[];return;end + + // Loads libraries related to m2sci + if exists("m2skernellib")==0 then load("SCI/modules/m2sci/macros/kernel/lib"),end + if exists("m2spercentlib")==0 then load("SCI/modules/m2sci/macros/percent/lib"),end + if exists("m2ssci_fileslib")==0 then load("SCI/modules/m2sci/macros/sci_files/lib"),end + + // Convert paths so that they can be used according to the platform + + sep = filesep(); + if getos() == "Windows" then + Paths=strsubst(Paths,"/",sep) + res_path=strsubst(res_path,"/",sep) + else + Paths=strsubst(Paths,"\",sep) + res_path=strsubst(res_path,"\",sep) + end + + // Close resolution path with a / or a \ + res_path=stripblanks(res_path) + if part(res_path,length(res_path))<>sep then + res_path=res_path+sep + end + + // Create a logfile and a whatis file + Paths=stripblanks(Paths) + [tempfd,ierr]=file("open",pathconvert(TMPDIR)+gettext("unitfile.dat"),"old"); + + if ierr==0 then + load(pathconvert(TMPDIR)+gettext("unitfile.dat")) + file("close",whsfil_unit); + file("close",tempfd); + mdelete(pathconvert(TMPDIR)+gettext("unitfile.dat")) + end + + whsfil_unit=file("open",res_path+"whatis","unknown") + save(pathconvert(TMPDIR)+gettext("unitfile.dat"),whsfil_unit) + // Close paths with a / or a \ + for k=1:size(Paths,"*") + if part(Paths(k),length(Paths(k)))<>sep then + Paths(k)=Paths(k)+sep, + end + end + + // Find names of files to translate + // mfiles is a vector which contains the names (and the paths) of files to translate + mfiles=[] + for k=1:size(Paths,"*") + path = Paths(k); + mfiles = [mfiles; ls(path+"*.m")]; + end + + // fnamvect is a vector which contains all M-files names (just the names) found in Paths + // filefuncallname is a list of vectors. The first component of each vector is the name of a M-file (found in the Path(s)) to translate, followed by the called functions by this M-file) + fnamvect=[] + filefuncallname=list() + for k1=1:size(mfiles,1) + kk=strindex(mfiles(k1),sep) + fnamvect=[fnamvect;part(mfiles(k1),kk($)+1:length(mfiles(k1))-2)] + end + + for k1=1:size(mfiles,1) + mpath=mfiles(k1) + // disp(gettext("********************lst_funcall**********************")) + // disp(mpath) + filefuncallname($+1)=lst_funcall(mpath,fnamvect) + end + + // Determination of a translation order for the M-files found in the Paths + // transorder is a vector containing the M-files names which are arranged to order to respect an priority order of translation + transorder=[] + for i=1:size(filefuncallname) + execstr(filefuncallname(i)(1)+"vect=filefuncallname(i)") + end + + overfunname=[] + for i=1:size(filefuncallname) + execstr("transorder=translateorder(transorder,"+filefuncallname(i)(1)+"vect,overfunname)") + end + + // funpath is a vector which contains the M-files names (ands their paths) to translate + funpath=[] + for i=1:size(transorder,1) + ind=find(transorder(i)==fnamvect) + if ind<>[] then + funpath=[funpath;mfiles(ind)] + end + end + + // Translation is done only if M-file has changed + logtxt=[] + resumelogtxt=""; + + for i=1:size(funpath,1) + kk=strindex(funpath(i),sep) + mpath=funpath(i) + fnam=part(funpath(i),kk($)+1:length(funpath(i))-2) + scipath=res_path+fnam+".sci" + scepath=res_path+fnam+".sce" + + if newest(mpath,scipath,scepath)==1 then + [fd,ierr]=file("open",pathconvert(TMPDIR)+fnam+".m","old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + mfile2sci(pathconvert(TMPDIR)+fnam+".m",res_path, %t, %t) + file("close",fd) + mdelete(pathconvert(TMPDIR)+fnam+".m") + rmdir(pathconvert(TMPDIR)+pathconvert(fnam),"s") + else + mfile2sci(funpath(i),res_path, %t, %t) + end + + tmp_sci_file=pathconvert(TMPDIR)+"tmp_"+fnam+".sci" + ierr=execstr("exec(tmp_sci_file)","errcatch");errclear(); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + txt=[] + txt=mgetl(scipath) + txt=[txt;" ";mgetl(tmp_sci_file)] + mputl(txt,scipath); + mdelete(tmp_sci_file) + end + + // LOG + tmp_m2sci_file=pathconvert(TMPDIR)+"tmp_m2sci_"+fnam+".log" + m2scipath=res_path+"m2sci_"+fnam+".log" + logtxt=[logtxt;" ";" ";mgetl(m2scipath)] + mdelete(m2scipath) + + [fd,ierr]=file("open",tmp_m2sci_file,"old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + logtxt=[logtxt;" ";mgetl(tmp_m2sci_file)] + file("close",fd) + mdelete(tmp_m2sci_file) + end + + // RESUMELOG + tmp_resume_m2sci_file=pathconvert(TMPDIR)+"tmp_resume_m2sci_"+fnam+".log" + resumem2scipath=res_path+"resume_m2sci_"+fnam+".log" + if fileinfo(resumem2scipath)<>[] then + resumelogtxt=[resumelogtxt;" ";" ";mgetl(resumem2scipath)] + mdelete(resumem2scipath) + end + + [fd,ierr]=file("open",tmp_resume_m2sci_file,"old"); + if ierr==0 & strindex(mpath,TMPDIR)==[] then + resumelogtxt=[resumelogtxt;" ";mgetl(tmp_resume_m2sci_file)] + file("close",fd) + mdelete(tmp_resume_m2sci_file) + end + end + if isempty(logtxt) then + logtxt = "" + end + mputl(logtxt,res_path+"log"); + if isempty(resumelogtxt) then + resumelogtxt = "" + end + mputl(resumelogtxt,res_path+"resumelog"); + end + + // File closing + file("close",whsfil_unit); + mdelete(pathconvert(TMPDIR)+gettext("unitfile.dat")) + + // create builder.sce and loader.sce files + // get the directory name where the Scilab functions are written + if res_path=="./" then + current_path=pathconvert(unix_g("pwd")) + index_slash=strindex(current_path,"/") + if size(index_slash,"*")==1 then index_slash=[0 index_slash],end + namelib=part(current_path,index_slash($-1)+1:index_slash($)-1) + else + index_slash=strindex(res_path,"/") + if size(index_slash,"*")==1 then index_slash=[0 index_slash],end + namelib=part(res_path,index_slash($-1)+1:index_slash($)-1) + end + + //builder.sce + buildertxt=[] + buildertxt($+1)="path=get_absolute_file_path(""builder.sce"")" + buildertxt($+1)="genlib("""+namelib+"lib"",path)" + builderfile=res_path+"builder.sce" + mputl(buildertxt,builderfile); + //loader.sce + loadertxt=[] + loadertxt($+1)="path=get_absolute_file_path(""loader.sce"")" + loadertxt($+1)="load(path+"+"""lib"")" + loaderfile=res_path+"loader.sce" + mputl(loadertxt,loaderfile); + +endfunction |