Scilab2C Functions Annotations — Scilab to C Converter : Functions Annotations How To
The annotation of every Scilab function is mandatory. Only the main function of the Scilab program you are translating doesn’t need any annotation.
The main function can not return any output argument and can not accept any input argument.
It is important to specify for each output argument of the Scilab function, its size and type in order to have the possibility to allocate the correct memory space at translation time. When the size of the returned output can be estimated only at run time, as happens for find-like functions that return an output whose size is related to the condition tested by the function, the user must be able to specify at least the maximum size that can be returned by the function. If it is not possible then the function should dynamically allocate memory and so can not be translated by Sci2C.
Function annotation must specify:
//SCI2C: NIN= 1 //SCI2C: NOUT= 2 //SCI2C: OUT(1).TP= IN(1).TP //SCI2C: OUT(1).SZ(1)= IN(1).SZ(1) //SCI2C: OUT(1).SZ(2)= IN(1).SZ(2) //SCI2C: OUT(2).TP= IN(1).TP //SCI2C: OUT(2).SZ(1)= IN(1).SZ(1) //SCI2C: OUT(2).SZ(2)= IN(1).SZ(2) //SCI2C: DEFAULT_PRECISION= DOUBLEThis will declare a function with the following informations:
NIN= 2 NOUT= 2 OUT(1).TP= IN(1).TP OUT(1).SZ(1)= '1' OUT(1).SZ(2)= FA_MUL(IN(1).SZ(1),IN(1).SZ(2)) OUT(2).TP= IN(1).TP OUT(2).SZ(1)= '1' OUT(2).SZ(2)= FA_MUL(IN(1).SZ(1),IN(1).SZ(2))This will declare a function with the following informations: