13
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="About_M2SCI_tools">
15
<refname>About M2SCI tools</refname>
16
<refpurpose>Generally speaking about tools to convert Matlab files to Scilab</refpurpose>
19
<title>Description</title>
20
<para>Scilab includes useful tools to convert Matlab M-files to Scilab.</para>
22
Taking a Matlab M-file, <literal>mfile2sci</literal> modifies this files so that it can be
23
compiled by Scilab. After that this compiled code is converted to a "tree" of instructions
24
by <literal>macr2tree</literal>. This "tree" is an imbrication of Scilab lists and tlists and
25
is the basis for conversion. Each instruction of this "tree" is converted to Scilab and
26
inference is done to known what are the variables. Once this "tree" is converted to Scilab,
27
code is generated using <literal>tree2code</literal>.
30
All tlists used for coding this tree (and we call "MSCI tlists") are listed below:
39
tlist representing a function call created by <literal>Funcall</literal>
44
<term>operation</term>
47
tlist representing an operation created by <literal>Operation</literal>
55
tlist representing a variable created by <literal>Variable</literal>
63
tlist representing a constant created by <literal>Cste</literal>
71
tlist representing an instruction created by <literal>Equal</literal>
76
<term>ifthenelse</term>
78
<para>tlist representing an IF/THEN/ELSE control instruction created inside M2SCI kernel functions</para>
84
<para>tlist representing a WHILE control instruction created inside M2SCI kernel functions</para>
88
<term>selectcase</term>
90
<para>tlist representing a SELECT/CASE control instruction created inside M2SCI kernel functions</para>
96
<para>tlist representing a FOR control instruction created inside M2SCI kernel functions</para>
103
The contents of these tlists is described in corresponding help pages.
106
Operations are converted using a fonction named <literal>%<opcode>2sci</literal> with opcode
107
the Scilab code for this operator. See help page for overloading to have these codes. All
108
these functions are already written and are in directory SCI/modules/m2sci/macros/percent/.
111
Function calls are converted using a function called <literal>sci_<Matlab_function_name></literal>.
112
Some of these functions have been written and are in directory SCI/modules/m2sci/macros/sci_files/.
113
We are working on increasing the set of Matlab functions converted. However, everybody can
114
written such functions using help page sci_files.
117
Inference is done using tlists of type "infer" containing fields:
125
<para>list of dimensions</para>
131
<para>"type" tlist</para>
135
<term>contents</term>
137
<para>"contents" tlist if a Cell or a Struct</para>
144
Type is a tlist of type "type" containing fields:
152
<para>data type</para>
156
<term>property</term>
158
<para>property</para>
164
<para>To have more details about inference see help page for m2scideclare.</para>
166
<refsection role="see also">
167
<title>See Also</title>
168
<simplelist type="inline">
170
<link linkend="mfile2sci">mfile2sci</link>
173
<link linkend="translatepaths">translatepaths</link>
176
<link linkend="overloading">overloading</link>
179
<link linkend="sci_files">sci_files</link>
182
<link linkend="Funcall">Funcall</link>
185
<link linkend="Operation">Operation</link>
188
<link linkend="Variable">Variable</link>
191
<link linkend="Cste">Cste</link>
194
<link linkend="Infer">Infer</link>
197
<link linkend="Type">Type</link>
200
<link linkend="Equal">Equal</link>
203
<link linkend="m2scideclare">m2scideclare</link>
15
<refname>About M2SCI tools</refname>
16
<refpurpose>Generally speaking about tools to convert Matlab files to Scilab</refpurpose>
19
<title>Description</title>
20
<para>Scilab includes useful tools to convert Matlab M-files to Scilab.</para>
22
Taking a Matlab M-file, <literal>mfile2sci</literal> modifies this files so that it can be
23
compiled by Scilab. After that this compiled code is converted to a "tree" of instructions
24
by <literal>macr2tree</literal>. This "tree" is an imbrication of Scilab lists and tlists and
25
is the basis for conversion. Each instruction of this "tree" is converted to Scilab and
26
inference is done to known what are the variables. Once this "tree" is converted to Scilab,
27
code is generated using <literal>tree2code</literal>.
30
All tlists used for coding this tree (and we call "MSCI tlists") are listed below:
39
tlist representing a function call created by <literal>Funcall</literal>
44
<term>operation</term>
47
tlist representing an operation created by <literal>Operation</literal>
55
tlist representing a variable created by <literal>Variable</literal>
63
tlist representing a constant created by <literal>Cste</literal>
71
tlist representing an instruction created by <literal>Equal</literal>
76
<term>ifthenelse</term>
78
<para>tlist representing an IF/THEN/ELSE control instruction created inside M2SCI kernel functions</para>
84
<para>tlist representing a WHILE control instruction created inside M2SCI kernel functions</para>
88
<term>selectcase</term>
90
<para>tlist representing a SELECT/CASE control instruction created inside M2SCI kernel functions</para>
96
<para>tlist representing a FOR control instruction created inside M2SCI kernel functions</para>
103
The contents of these tlists is described in corresponding help pages.
106
Operations are converted using a fonction named <literal>%<opcode>2sci</literal> with opcode
107
the Scilab code for this operator. See help page for overloading to have these codes. All
108
these functions are already written and are in directory SCI/modules/m2sci/macros/percent/.
111
Function calls are converted using a function called <literal>sci_<Matlab_function_name></literal>.
112
Some of these functions have been written and are in directory SCI/modules/m2sci/macros/sci_files/.
113
We are working on increasing the set of Matlab functions converted. However, everybody can
114
written such functions using help page sci_files.
117
Inference is done using tlists of type "infer" containing fields:
125
<para>list of dimensions</para>
131
<para>"type" tlist</para>
135
<term>contents</term>
137
<para>"contents" tlist if a Cell or a Struct</para>
144
Type is a tlist of type "type" containing fields:
152
<para>data type</para>
156
<term>property</term>
158
<para>property</para>
164
<para>To have more details about inference see help page for m2scideclare.</para>
166
<refsection role="see also">
167
<title>See Also</title>
168
<simplelist type="inline">
170
<link linkend="mfile2sci">mfile2sci</link>
173
<link linkend="translatepaths">translatepaths</link>
176
<link linkend="overloading">overloading</link>
179
<link linkend="sci_files">sci_files</link>
182
<link linkend="Funcall">Funcall</link>
185
<link linkend="Operation">Operation</link>
188
<link linkend="Variable">Variable</link>
191
<link linkend="Cste">Cste</link>
194
<link linkend="Infer">Infer</link>
197
<link linkend="Type">Type</link>
200
<link linkend="Equal">Equal</link>
203
<link linkend="m2scideclare">m2scideclare</link>