diff options
author | imushir | 2015-12-28 16:08:36 +0530 |
---|---|---|
committer | imushir | 2015-12-28 16:08:36 +0530 |
commit | a5ffe09fca6b245c7af5a1072a124492cfc3f1b9 (patch) | |
tree | b7a3d16b8b4b5eeb67a5313032082a371cf76b5b /2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci | |
parent | b78d9ee3ae4c216c3b6bef13ba5637833381f529 (diff) | |
parent | 9bee3723b675d7ab65b757d38cf9c5938a63531a (diff) | |
download | Scilab2C-a5ffe09fca6b245c7af5a1072a124492cfc3f1b9.tar.gz Scilab2C-a5ffe09fca6b245c7af5a1072a124492cfc3f1b9.tar.bz2 Scilab2C-a5ffe09fca6b245c7af5a1072a124492cfc3f1b9.zip |
Merge branch 'master' of https://github.com/siddhu8990/Scilab2C
Fetching master
Diffstat (limited to '2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci')
-rw-r--r-- | 2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci new file mode 100644 index 00000000..db96e190 --- /dev/null +++ b/2.3-1/macros/Scilab-Arduino/GenerateSetupFunction.sci @@ -0,0 +1,34 @@ +function GenerateSetupFunction(FileInfo) + +SetupListFile = FileInfo.SetupListFile; + +load(SetupListFile,'SetupList'); + +SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c'); +C_SCI2CHeader(SetupArduinoFile); + +PrintStringInfo('#include ""setup_arduino.h""',SetupArduinoFile,'file','y'); +PrintStringInfo(' ',SetupArduinoFile,'file','y'); +PrintStringInfo('int setup_arduino()',SetupArduinoFile,'file','y'); +PrintStringInfo('{',SetupArduinoFile,'file','y'); + +nelements=size(SetupList); + +for i=1:nelements + funcall = ' '; + funcall = funcall + SetupList(i)(1); + funcall = funcall + '('; + NInArg = size(SetupList(i))-1; + for j=1:NInArg-1 + funcall = funcall + SetupList(i)(j+1); + funcall = funcall + ', '; + end + funcall = funcall + SetupList(i)(NInArg+1); + funcall = funcall + ');'; + PrintStringInfo(funcall,SetupArduinoFile,'file','y'); +end +PrintStringInfo(' ',SetupArduinoFile,'file','y'); +PrintStringInfo(' return (0); ',SetupArduinoFile,'file','y'); +PrintStringInfo('}',SetupArduinoFile,'file','y'); + +endfunction |