1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
4
<LANGUAGE>eng</LANGUAGE>
5
<TITLE>sci_files</TITLE>
6
<TYPE>Documentation</TYPE>
7
<DATE>March 2004</DATE>
9
<SHORT_DESCRIPTION name="sci_files">How to write conversion functions</SHORT_DESCRIPTION>
13
To convert calls to Matlab functions, <VERB>mfile2sci</VERB> uses a function called
14
<VERB>sci_<Matlab_function_name></VERB>. All these functions are defined in <TT>sci_files</TT>
15
in directory SCI/macros/m2sci/sci_files/. The set of <TT>sci_files</TT> given in Scilab
16
distribution does not allow to convert calls to all Matlab functions yet.
17
However, a Scilab user can add <TT>sci_files</TT> (for Matlab functions or for user defined functions)
18
to Scilab using the following tips.
22
In M2SCI, a function call is considered as a "tree" (it is also the case for the instructions
23
of the file to convert), represented in Scilab by a <VERB>tlist</VERB> with following fields:
30
<SP>: Matlab function name</SP>
33
<SP>: number of Matlab function output parameters</SP>
36
<SP>: list of Matlab function output parameters</SP>
39
<SP>: list of Matlab function input parameters</SP>
46
A <TT>sci_function</TT> has one input called <VERB>tree</VERB> which is also the output of the function.
47
A <TT>sci_function</TT> has to convert this incoming "tree" so that it is compatible with Scilab
48
by changing name, lhsnb, lhs and/or rhs. The other task that has to be done by this function
49
is inference. Incoming tree contains inference data in its lhs that have to be updated with what
50
can be infered for the outputs of this function.
54
Some useful functions have been written to help to write this conversion function:
60
<ITEM label="Funcall">
61
<SP>: create a tree representing a function call</SP>
63
<ITEM label="Operation">
64
<SP>: create a tree representing an operation</SP>
66
<ITEM label="Variable">
67
<SP>: create a tree representing a variable</SP>
70
<SP>: create a tree representing a constante value</SP>
73
<SP>: create a tree representing inference data</SP>
76
<SP>: create a tree representing type for inference</SP>
79
<SP>: create a tree representing an instruction</SP>
86
To have more informations about how to write such files, refer to directory
87
SCI/macros/m2sci/sci_files/ which gives many examples from very simple ones
88
(e.g. sci_abs.sci) to very complex ones (e.g. sci_zeros.sci).
94
<SEE_ALSO_ITEM> <LINK>m2scideclare</LINK> </SEE_ALSO_ITEM>
95
<SEE_ALSO_ITEM> <LINK>Funcall</LINK> </SEE_ALSO_ITEM>
96
<SEE_ALSO_ITEM> <LINK>Operation</LINK> </SEE_ALSO_ITEM>
97
<SEE_ALSO_ITEM> <LINK>Variable</LINK> </SEE_ALSO_ITEM>
98
<SEE_ALSO_ITEM> <LINK>Cste</LINK> </SEE_ALSO_ITEM>
99
<SEE_ALSO_ITEM> <LINK>Infer</LINK> </SEE_ALSO_ITEM>
100
<SEE_ALSO_ITEM> <LINK>Type</LINK> </SEE_ALSO_ITEM>
101
<SEE_ALSO_ITEM> <LINK>Equal</LINK> </SEE_ALSO_ITEM>
105
<AUTHORS_ITEM>V.C.</AUTHORS_ITEM>