1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="en" xml:id="About_M2SCI_tools">
21 <refname>About M2SCI tools</refname>
22 <refpurpose>Generally speaking about tools to convert Matlab files to Scilab</refpurpose>
25 <title>Description</title>
26 <para>Scilab includes useful tools to convert Matlab M-files to Scilab.</para>
28 Taking a Matlab M-file, <literal>mfile2sci</literal> modifies this files so that it can be
29 compiled by Scilab. Then, this compiled code is converted to a "tree" of instructions
30 by <literal>macr2tree</literal>. This "tree" is an imbrication of Scilab lists and tlists and
31 is the basis for conversion. Each instruction of this "tree" is converted to Scilab and
32 inference is done to known what are the variables. Once this "tree" is converted to Scilab,
33 code is generated using <literal>tree2code</literal>.
36 All tlists used for coding this tree (and we call "MSCI tlists") are listed below:
45 tlist representing a function call created by <literal>Funcall</literal>
50 <term>operation</term>
53 tlist representing an operation created by <literal>Operation</literal>
61 tlist representing a variable created by <literal>Variable</literal>
69 tlist representing a constant created by <literal>Cste</literal>
77 tlist representing an instruction created by <literal>Equal</literal>
82 <term>ifthenelse</term>
84 <para>tlist representing an IF/THEN/ELSE control instruction created inside M2SCI kernel functions</para>
90 <para>tlist representing a WHILE control instruction created inside M2SCI kernel functions</para>
94 <term>selectcase</term>
96 <para>tlist representing a SELECT/CASE control instruction created inside M2SCI kernel functions</para>
102 <para>tlist representing a FOR control instruction created inside M2SCI kernel functions</para>
109 The contents of these tlists is described in corresponding help pages.
112 Operations are converted using a function named <literal>%<opcode>2sci</literal> with opcode
113 the Scilab code for this operator. See help page for overloading to have these codes. All
114 these functions are already written and are in directory SCI/modules/m2sci/macros/percent/.
117 Function calls are converted using a function called <literal>sci_<Matlab_function_name></literal>.
118 Some of these functions have been written and are in directory SCI/modules/m2sci/macros/sci_files/.
119 We are working on increasing the set of Matlab functions converted. However, everybody can
120 write such functions using help page sci_files.
123 Inference is done using tlists of type "infer" containing fields:
129 <para>list of dimensions</para>
135 <para>"type" tlist</para>
139 <term>contents</term>
141 <para>"contents" tlist if a Cell or a Struct</para>
146 Type is a tlist of type "type" containing fields:
152 <para>data type</para>
156 <term>property</term>
158 <para>property</para>
162 <para>To have more details about inference see help page for m2scideclare.</para>
164 <refsection role="see also">
165 <title>See also</title>
166 <simplelist type="inline">
168 <link linkend="mfile2sci">mfile2sci</link>
171 <link linkend="translatepaths">translatepaths</link>
174 <link linkend="overloading">overloading</link>
177 <link linkend="sci_files">sci_files</link>
180 <link linkend="Funcall">Funcall</link>
183 <link linkend="Operation">Operation</link>
186 <link linkend="Variable">Variable</link>
189 <link linkend="Cste">Cste</link>
192 <link linkend="Infer">Infer</link>
195 <link linkend="Type">Type</link>
198 <link linkend="Equal">Equal</link>
201 <link linkend="m2scideclare">m2scideclare</link>