sci_files - How to write conversion functions
To convert calls to Matlab functions, mfile2sci uses a function called sci_<Matlab_function_name> . All these functions are defined in sci_files in directory SCI/macros/m2sci/sci_files/. The set of sci_files given in Scilab distribution does not allow to convert calls to all Matlab functions yet. However, a Scilab user can add sci_files (for Matlab functions or for user defined functions) to Scilab using the following tips.
In M2SCI, a function call is considered as a "tree" (it is also the case for the instructions of the file to convert), represented in Scilab by a tlist with following fields:
A sci_function has one input called tree which is also the output of the function. A sci_function has to convert this incoming "tree" so that it is compatible with Scilab by changing name, lhsnb, lhs and/or rhs. The other task that has to be done by this function is inference. Incoming tree contains inference data in its lhs that have to be updated with what can be infered for the outputs of this function.
Some useful functions have been written to help to write this conversion function:
To have more informations about how to write such files, refer to directory SCI/macros/m2sci/sci_files/ which gives many examples from very simple ones (e.g. sci_abs.sci) to very complex ones (e.g. sci_zeros.sci).
m2scideclare , Funcall , Operation , Variable , Cste , Infer , Type , Equal ,