From fa48de77a489b8b6e7c5cb335b8dc55721cf2a28 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Fri, 11 Sep 2015 02:28:56 +0530 Subject: Changes made for making directory 'arduino' in output folder' --- macros/CCodeGeneration/C_FinalizeCode.bin | Bin 12872 -> 13696 bytes macros/CCodeGeneration/C_FinalizeCode.sci | 3 ++ macros/CCodeGeneration/C_GenerateMakefile.bin | Bin 17792 -> 17792 bytes macros/CCodeGeneration/C_InitHeader.bin | Bin 11856 -> 13696 bytes macros/CCodeGeneration/C_InitHeader.sci | 3 ++ macros/CCodeGeneration/C_Type.bin | Bin 9600 -> 9600 bytes macros/ToolInitialization/INIT_CreateDirs.bin | Bin 9600 -> 9600 bytes .../ToolInitialization/INIT_GenAnnFLFunctions.bin | Bin 9600 -> 9600 bytes macros/ToolInitialization/INIT_GenFileInfo.bin | Bin 13696 -> 13696 bytes macros/ToolInitialization/INIT_GenLibraries.bin | Bin 9600 -> 9600 bytes macros/ToolInitialization/INIT_GenSharedInfo.bin | Bin 13696 -> 13696 bytes macros/ToolInitialization/INIT_GenSharedInfo.sci | 11 ++++- macros/ToolInitialization/INIT_LoadLibraries.bin | Bin 9600 -> 9600 bytes macros/ToolInitialization/INIT_RemoveDirs.bin | Bin 13696 -> 13696 bytes macros/ToolInitialization/INIT_SCI2C.bin | Bin 21152 -> 21152 bytes macros/ToolInitialization/INIT_SCI2C.sci | 4 +- macros/ToolInitialization/INIT_SharedInfoEqual.bin | Bin 9600 -> 9600 bytes macros/ToolInitialization/ManageNextConversion.bin | Bin 13696 -> 13696 bytes macros/ToolInitialization/UpdateSCI2CInfo.bin | Bin 30256 -> 30256 bytes macros/cb_sci2c_gui.sci | 19 +++++++- macros/findDeps/getAllHeaders.bin | Bin 13696 -> 13696 bytes macros/findDeps/getAllInterfaces.bin | Bin 13696 -> 13696 bytes macros/findDeps/getAllSources.bin | Bin 89136 -> 89136 bytes macros/findDeps/getArduinoFiles.sci | 17 +++++++ macros/findDeps/names | 1 + macros/runsci2c.sci | 48 +++++++++++++++----- macros/sci2c_gui.sci | 49 ++++++++++++++++++--- macros/scilab2c.sci | 45 ++++++++++++++++--- 28 files changed, 172 insertions(+), 28 deletions(-) create mode 100644 macros/findDeps/getArduinoFiles.sci (limited to 'macros') diff --git a/macros/CCodeGeneration/C_FinalizeCode.bin b/macros/CCodeGeneration/C_FinalizeCode.bin index 04b6e33..a2e3e12 100644 Binary files a/macros/CCodeGeneration/C_FinalizeCode.bin and b/macros/CCodeGeneration/C_FinalizeCode.bin differ diff --git a/macros/CCodeGeneration/C_FinalizeCode.sci b/macros/CCodeGeneration/C_FinalizeCode.sci index 5c26dd8..69cad55 100644 --- a/macros/CCodeGeneration/C_FinalizeCode.sci +++ b/macros/CCodeGeneration/C_FinalizeCode.sci @@ -50,6 +50,9 @@ PrintStringInfo('** ---------------------------- ',Pass1HeaderFileName,'file','y PrintStringInfo('** --- End USER2C Includes. --- ',Pass1HeaderFileName,'file','y'); PrintStringInfo('** ---------------------------- ',Pass1HeaderFileName,'file','y'); PrintStringInfo('*/',Pass1HeaderFileName,'file','y'); +PrintStringInfo('#ifdef __cplusplus',Pass1HeaderFileName,'file','y'); +PrintStringInfo('} /* extern ""C"" */',Pass1HeaderFileName,'file','y'); +PrintStringInfo('#endif',Pass1HeaderFileName,'file','y'); PrintStringInfo('#endif',Pass1HeaderFileName,'file','y'); // ------------------------------------- // --- End Finalize the header file. --- diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin index fd2de29..bbb2cea 100644 Binary files a/macros/CCodeGeneration/C_GenerateMakefile.bin and b/macros/CCodeGeneration/C_GenerateMakefile.bin differ diff --git a/macros/CCodeGeneration/C_InitHeader.bin b/macros/CCodeGeneration/C_InitHeader.bin index 76b8a7e..0147576 100644 Binary files a/macros/CCodeGeneration/C_InitHeader.bin and b/macros/CCodeGeneration/C_InitHeader.bin differ diff --git a/macros/CCodeGeneration/C_InitHeader.sci b/macros/CCodeGeneration/C_InitHeader.sci index 7d79412..41e13e4 100644 --- a/macros/CCodeGeneration/C_InitHeader.sci +++ b/macros/CCodeGeneration/C_InitHeader.sci @@ -46,6 +46,9 @@ PrintStringInfo('** --------------------------- ',HeaderFileName,'file','y'); PrintStringInfo('*/',HeaderFileName,'file','y'); PrintStringInfo(' ',HeaderFileName,'file','y'); PrintStringInfo(' ',HeaderFileName,'file','y'); +PrintStringInfo('#ifdef __cplusplus',HeaderFileName,'file','y'); +PrintStringInfo('extern ""C"" {',HeaderFileName,'file','y'); +PrintStringInfo('#endif',HeaderFileName,'file','y'); PrintStringInfo('/*',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('** --- Prototypes. --- ',HeaderFileName,'file','y'); diff --git a/macros/CCodeGeneration/C_Type.bin b/macros/CCodeGeneration/C_Type.bin index 7ddf022..36a9458 100644 Binary files a/macros/CCodeGeneration/C_Type.bin and b/macros/CCodeGeneration/C_Type.bin differ diff --git a/macros/ToolInitialization/INIT_CreateDirs.bin b/macros/ToolInitialization/INIT_CreateDirs.bin index b77a9af..2925a70 100644 Binary files a/macros/ToolInitialization/INIT_CreateDirs.bin and b/macros/ToolInitialization/INIT_CreateDirs.bin differ diff --git a/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin b/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin index 8d9139d..3f8981a 100644 Binary files a/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin and b/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin differ diff --git a/macros/ToolInitialization/INIT_GenFileInfo.bin b/macros/ToolInitialization/INIT_GenFileInfo.bin index 8ba0ebd..733ab51 100644 Binary files a/macros/ToolInitialization/INIT_GenFileInfo.bin and b/macros/ToolInitialization/INIT_GenFileInfo.bin differ diff --git a/macros/ToolInitialization/INIT_GenLibraries.bin b/macros/ToolInitialization/INIT_GenLibraries.bin index 6626be9..a1bf6f5 100644 Binary files a/macros/ToolInitialization/INIT_GenLibraries.bin and b/macros/ToolInitialization/INIT_GenLibraries.bin differ diff --git a/macros/ToolInitialization/INIT_GenSharedInfo.bin b/macros/ToolInitialization/INIT_GenSharedInfo.bin index 56b0428..9c82bde 100644 Binary files a/macros/ToolInitialization/INIT_GenSharedInfo.bin and b/macros/ToolInitialization/INIT_GenSharedInfo.bin differ diff --git a/macros/ToolInitialization/INIT_GenSharedInfo.sci b/macros/ToolInitialization/INIT_GenSharedInfo.sci index 7b8826c..a61eb72 100644 --- a/macros/ToolInitialization/INIT_GenSharedInfo.sci +++ b/macros/ToolInitialization/INIT_GenSharedInfo.sci @@ -1,4 +1,4 @@ -function SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName,CopySciCodeIntoCCode) +function SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName,CopySciCodeIntoCCode,OutFormat) // function SharedInfo = INIT_GenSharedInfo(WorkingDir,OutCCCodeDir,UserSciFilesPaths,... // RunMode,UserScilabMainFile,TotTempScalarVars,EnableTempVarsReuse,Sci2CLibMainHeaderFName) // ----------------------------------------------------------------- @@ -47,7 +47,11 @@ SharedInfo.Sci2CLibMainHeaderFName = pathconvert(Sci2CLibMainHeaderFName, %f, %f SharedInfo.NextSCIFileName = UserScilabMainFile; [scipath,funname,sciext] = fileparts(UserScilabMainFile); SharedInfo.SCIMainFunName = funname; -SharedInfo.CMainFunName = 'main'; +if (OutFormat == 'Arduino') + SharedInfo.CMainFunName = 'loop_arduino'; +else + SharedInfo.CMainFunName = 'main'; +end SharedInfo.NextSCIFunName = SharedInfo.SCIMainFunName; //NUT: per ora no so cosa metter SharedInfo.NextCFunName = SharedInfo.CMainFunName; //NUT: per ora no so cosa metter //NUT: questo viene aggiornato dalla C_Funcall SharedInfo.NextSCIFunNumber = 1; @@ -115,4 +119,7 @@ SharedInfo.Extension.FuncListClasses = '.lcls'; // Stands for list class // --- Resize Approach. --- // ------------------------ SharedInfo.ResizeApproach = 'NO_RESIZE'; // 'NO_RESIZE', 'RESIZE_ALL', 'RESIZE_TEMP', 'RESIZE_LOCAL', 'RESIZE_GLOBAL', 'REALLOC_ALL_RESIZE_ALL' + +SharedInfo.OutFormat = OutFormat; + endfunction diff --git a/macros/ToolInitialization/INIT_LoadLibraries.bin b/macros/ToolInitialization/INIT_LoadLibraries.bin index 38cd5bb..35bc6a1 100644 Binary files a/macros/ToolInitialization/INIT_LoadLibraries.bin and b/macros/ToolInitialization/INIT_LoadLibraries.bin differ diff --git a/macros/ToolInitialization/INIT_RemoveDirs.bin b/macros/ToolInitialization/INIT_RemoveDirs.bin index fd1298a..5a3cc93 100644 Binary files a/macros/ToolInitialization/INIT_RemoveDirs.bin and b/macros/ToolInitialization/INIT_RemoveDirs.bin differ diff --git a/macros/ToolInitialization/INIT_SCI2C.bin b/macros/ToolInitialization/INIT_SCI2C.bin index fb6b72a..1c2b2d3 100644 Binary files a/macros/ToolInitialization/INIT_SCI2C.bin and b/macros/ToolInitialization/INIT_SCI2C.bin differ diff --git a/macros/ToolInitialization/INIT_SCI2C.sci b/macros/ToolInitialization/INIT_SCI2C.sci index 8b3e5b2..4065d04 100644 --- a/macros/ToolInitialization/INIT_SCI2C.sci +++ b/macros/ToolInitialization/INIT_SCI2C.sci @@ -1,5 +1,5 @@ function [FileInfoDatFile,SharedInfoDatFile] = ... - INIT_SCI2C(UserScilabMainFile, UserSciFilesPaths, SCI2COutputDir, RunMode) + INIT_SCI2C(UserScilabMainFile, UserSciFilesPaths, SCI2COutputDir, RunMode,OutFormat) // function [FileInfoDatFile,SharedInfoDatFile] = INIT_SCI2C(SCI2CInputPrmFile) // ----------------------------------------------------------------- // #RNU_RES_B @@ -68,7 +68,7 @@ OutCCCodeDir = SCI2CResultDir; //-- FIXME : MainLibHeader and Verbose mode are (?) configurable SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile, ... - TotTempScalarVars,EnableTempVarsReuse,"sci2clib.h", %t); + TotTempScalarVars,EnableTempVarsReuse,"sci2clib.h", %t,OutFormat); // ---------------------------- // --- Initialize FileInfo. --- diff --git a/macros/ToolInitialization/INIT_SharedInfoEqual.bin b/macros/ToolInitialization/INIT_SharedInfoEqual.bin index 33f96da..6737e64 100644 Binary files a/macros/ToolInitialization/INIT_SharedInfoEqual.bin and b/macros/ToolInitialization/INIT_SharedInfoEqual.bin differ diff --git a/macros/ToolInitialization/ManageNextConversion.bin b/macros/ToolInitialization/ManageNextConversion.bin index 1d428d2..03565bd 100644 Binary files a/macros/ToolInitialization/ManageNextConversion.bin and b/macros/ToolInitialization/ManageNextConversion.bin differ diff --git a/macros/ToolInitialization/UpdateSCI2CInfo.bin b/macros/ToolInitialization/UpdateSCI2CInfo.bin index 4bc5a55..2ee6b8d 100644 Binary files a/macros/ToolInitialization/UpdateSCI2CInfo.bin and b/macros/ToolInitialization/UpdateSCI2CInfo.bin differ diff --git a/macros/cb_sci2c_gui.sci b/macros/cb_sci2c_gui.sci index 935c0e6..9d1770f 100644 --- a/macros/cb_sci2c_gui.sci +++ b/macros/cb_sci2c_gui.sci @@ -54,6 +54,17 @@ elseif or(get(gcbo, "tag")==["runradioall","runradiotranslate","runradiogenlib"] set(gcbo, "value", 1); + +// --- Output format option --- + +elseif or(get(gcbo, "tag")==["outformatradiostalone","outformatradioarduino"]) then + + set(findobj("tag", "outformatradiostalone"), "value", 0); + set(findobj("tag", "outformatradioarduino"), "value", 0); + + set(gcbo, "value", 1); + + // // --- Copy Scilab code into C option --- // @@ -100,6 +111,12 @@ elseif get(gcbo, "tag")=="convertbtn" then RunMode = "GenLibraryStructure"; end + if get(findobj("tag", "outformatradiostalone"), "value") == 1 then + OutFormat = "StandAlone"; + elseif get(findobj("tag", "outformatradioarduino"), "value") == 1 then + OutFormat = "Arduino"; + end + CopySciCodeIntoCCode = get(findobj("tag", "sciintocradioyes"), "value") == 1; if get(findobj("tag", "buildtoolradiowin"), "value") == 1 then @@ -118,7 +135,7 @@ elseif get(gcbo, "tag")=="convertbtn" then // mprintf("RunMode = {%s}\n", RunMode); // mprintf("CopySciCodeIntoCCode = {%d}\n", bool2s(CopySciCodeIntoCCode)); // mprintf("NativeBuild = {%s}\n", NativeBuild); - scilab2c(UserScilabMainFile, UserSciCodeMainDir, UserSciFilesPaths, RunMode, NativeBuild); + scilab2c(UserScilabMainFile, UserSciCodeMainDir, UserSciFilesPaths, RunMode, NativeBuild,OutFormat); // // --- sci2c help --- // diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin index 4829622..b0355de 100644 Binary files a/macros/findDeps/getAllHeaders.bin and b/macros/findDeps/getAllHeaders.bin differ diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin index 6f0781e..1a0fedc 100644 Binary files a/macros/findDeps/getAllInterfaces.bin and b/macros/findDeps/getAllInterfaces.bin differ diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin index d5a5c97..a689472 100644 Binary files a/macros/findDeps/getAllSources.bin and b/macros/findDeps/getAllSources.bin differ diff --git a/macros/findDeps/getArduinoFiles.sci b/macros/findDeps/getArduinoFiles.sci new file mode 100644 index 0000000..a51d9b5 --- /dev/null +++ b/macros/findDeps/getArduinoFiles.sci @@ -0,0 +1,17 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +function arduinoFiles = getArduinoFiles() + arduinoFiles = [ + "src/c/scilab-arduino/default_files/Makefile" + "src/c/scilab-arduino/default_files/sci2c_arduino.ino"]; +endfunction diff --git a/macros/findDeps/names b/macros/findDeps/names index 2ba0b63..88d610b 100644 --- a/macros/findDeps/names +++ b/macros/findDeps/names @@ -3,3 +3,4 @@ getAllHeaders getAllInterfaces Scilab2CDeps findDeps +getArduinoFiles diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index fbdad31..ee7510e 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -1,4 +1,4 @@ -function runsci2c(UserScilabMainFile, UserSciFilesPaths, SCI2COutputPath, Runmode, BuildTool) +function runsci2c(UserScilabMainFile, UserSciFilesPaths, SCI2COutputPath, Runmode, BuildTool,OutFormat) // function runsci2c(SCI2CInputPrmFile) // ----------------------------------------------------------------- // === hArtes/PoliBa/GAP SCI2C tool === @@ -51,7 +51,7 @@ disp(RunSci2CMainDir); // --- Initialize the SCI2C tool directories and files. --- [FileInfoDatFile,SharedInfoDatFile] = INIT_SCI2C(UserScilabMainFile, ... - UserSciFilesPaths, SCI2COutputPath, RunMode); + UserSciFilesPaths, SCI2COutputPath, RunMode, OutFormat); // -- Load FileInfo and SharedInfo load(SharedInfoDatFile,'SharedInfo'); @@ -124,6 +124,37 @@ for i = 1:size(allInterfaces, "*") copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/"); end + +// -------------------------- +// --- Generate Makefile. --- +// -------------------------- +//If output format is chosen as 'Arduino', then copy makefile for arduino from +//default folder, else generate makefile for standalone c code + +if (OutFormat == 'Arduino') + mkdir(SCI2COutputPath+"/arduino/"); + mkdir(SCI2COutputPath+"/arduino/sci2c_arduino"); + //Copy arduino makefile + arduinoFiles = SCI2CHOME + "/" + getArduinoFiles(); + PrintStepInfo('Copying arduino files', FileInfo.GeneralReport,'both'); + for i = 1:size(arduinoFiles, "*") + // DEBUG only + //disp("Copying "+arduinoFiles(i)+" in "+SCI2COutputPath+"/arduino/sci2carduino"); + copyfile(arduinoFiles(i), SCI2COutputPath+"/arduino/sci2c_arduino/"); + end + +else + + if BuildTool == "make" + C_GenerateMakefile(FileInfo,SharedInfo); + end + if BuildTool == "nmake" + copyBlasLapackLibs(FileInfo,SharedInfo); + C_GenerateMakefile_msvc(FileInfo,SharedInfo); + end +end + + // ------------------------------ // --- Generate SCI2C Header. --- // ------------------------------ @@ -131,16 +162,7 @@ end FunctionPrefix = "SCI2C"; C_GenerateSCI2CHeader(SCI2COutputPath+"/includes/", FunctionPrefix); -// -------------------------- -// --- Generate Makefile. --- -// -------------------------- -if BuildTool == "make" - C_GenerateMakefile(FileInfo,SharedInfo); -end -if BuildTool == "nmake" - copyBlasLapackLibs(FileInfo,SharedInfo); - C_GenerateMakefile_msvc(FileInfo,SharedInfo); -end + // ----------------- // --- Epilogue. --- @@ -150,6 +172,8 @@ if (RunMode == 'All' | RunMode == 'Translate') elseif (RunMode == 'GenLibraryStructure') PrintStepInfo('Library Structure Successfully Created!!!',FileInfo.GeneralReport,'both'); end + + endfunction diff --git a/macros/sci2c_gui.sci b/macros/sci2c_gui.sci index c4ba038..3abe497 100644 --- a/macros/sci2c_gui.sci +++ b/macros/sci2c_gui.sci @@ -38,7 +38,7 @@ uimenu("parent", h, "label", gettext("Sci2c help page"), "callback", "cb_sci2c_g uimenu("parent", h, "label", gettext("About SCI2C tools..."), "callback", "cb_sci2c_gui", "tag", "about_sci2c_menu"); figw = 800; -figh = 15*margin + btnh + 7*widgeth; +figh = 15*margin + btnh + 9*widgeth; sci2cfig.axes_size = [figw figh]; sci2cfig.auto_resize = "on"; //sci2cfig.visible = "off"; // to be sure that no plot can appear in the window @@ -79,7 +79,7 @@ optframe = uicontrol("parent", sci2cfig,... "relief", "groove",... "style", "frame",... "units", "pixels",... - "position", [margin 2*margin+btnh figw-2*margin 4*margin+4*widgeth],... + "position", [margin 2*margin+btnh figw-2*margin 4*margin+6*widgeth],... "fontname", defaultfont,... "fontunits", "points",... "fontsize", 12,... @@ -90,7 +90,7 @@ opttitle = uicontrol("parent", sci2cfig,... "style", "text",... "string", gettext("Options"),... "units", "pixels",... - "position", [2*margin 2*margin+btnh+4*margin+4*widgeth-8 50 14],... + "position", [2*margin 2*margin+btnh+4*margin+6*widgeth-8 50 18],... "fontname", defaultfont,... "fontunits", "points",... "fontsize", 11,... @@ -175,8 +175,47 @@ sciintocradiono = uicontrol("parent", sci2cfig,... "callback", "cb_sci2c_gui",... "tag", "sciintocradiono"); +// --- Output format: Standalone or Arduino +outformaty = sciintocy + margin + btnh ; +outformatlabel = uicontrol("parent", sci2cfig,... + "style", "text",... + "string", gettext("Type of output format: "),... + "position",[2*margin outformaty widgetLabelWidth widgeth],... + "horizontalalignment", "left",... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12); + +outformatradiostalone = uicontrol("parent", sci2cfig,... + "style", "radiobutton",... + "string", gettext("Stand-alone"),... + "position",[2*margin+widgetLabelWidth outformaty 2*radiow widgeth],... + "horizontalalignment", "left",... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 1,... + "callback", "cb_sci2c_gui",... + "tag", "outformatradiostalone"); + +outformatradioarduino = uicontrol("parent", sci2cfig,... + "style", "radiobutton",... + "string", gettext("Arduino"),... + "position",[2*margin+widgetLabelWidth+2*radiow outformaty radiow widgeth],... + "horizontalalignment", "left",... + "fontname", defaultfont,... + "fontunits", "points",... + "fontsize", 12,... + "min", 0, ... + "max", 1, ... + "value", 0,... + "callback", "cb_sci2c_gui",... + "tag", "outformatradioarduino"); + // --- Run mode option --- -runy = sciintocy + margin + widgeth; +runy = outformaty + margin + widgeth; runlabel = uicontrol("parent", sci2cfig,... "style", "text",... "string", gettext("Run mode: "),... @@ -229,7 +268,7 @@ runradiogenlib = uicontrol("parent", sci2cfig,... // --- Output directory --- // ------------------------ // Frame -optframemaxy = 2*margin+btnh + 4*margin+4*widgeth; +optframemaxy = 2*margin+btnh + 4*margin+6*widgeth; outframe = uicontrol("parent", sci2cfig,... "relief", "groove",... "style", "frame",... diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index d922e0b..25fc06a 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -34,7 +34,8 @@ function scilab2c(varargin) CCodeOutputDir = varargin(2); UserSciFilesPaths = []; RunMode = 'All'; - BuildTool = getNativeBuildTool(); + BuildTool = getNativeBuildTool(); + OutFormat = "StandAlone" // // scilab2c(UserScilabMainFile, CCodeOutputDir, UserSciFilesPaths) // @@ -53,7 +54,8 @@ function scilab2c(varargin) UserSciFilesPaths = varargin(3); end RunMode = "All"; - BuildTool = getNativeBuildTool(); + BuildTool = getNativeBuildTool(); + OutFormat = "StandAlone" // // scilab2c(UserScilabMainFile, CCodeOutputDir, UserSciFilesPaths, RunMode) // @@ -76,7 +78,8 @@ function scilab2c(varargin) UserSciFilesPaths = varargin(3); end RunMode = varargin(4); - BuildTool = getNativeBuildTool(); + BuildTool = getNativeBuildTool(); + OutFormat = "StandAlone" case 5 for i = 1:4 if typeof(varargin(i)) <> "string" @@ -100,7 +103,37 @@ function scilab2c(varargin) UserSciFilesPaths = varargin(3); end RunMode = varargin(4); - BuildTool = varargin(5); + BuildTool = varargin(5); + OutFormat = "StandAlone" + case 6 + for i = 1:4 + if typeof(varargin(i)) <> "string" + error(msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"),"scilab2c",i)); + return + end + end + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"" or ""GenLibraryStructure"".\n"),"scilab2c",4)); + return + end + if varargin(5) <> "make" & varargin(5) <> "nmake" + error(msprintf(gettext("%s: argument #%d must be: ""make"" or ""nmake"".\n"),"scilab2c",5)); + return + end + if varargin(6) <> "StandAlone" & varargin(6) <> "Arduino" + error(msprintf(gettext("%s: argument #%d must be: ""StandAlone"" or ""Arduino"".\n"),"scilab2c",5)); + return + end + UserScilabMainFile = varargin(1); + CCodeOutputDir = varargin(2); + if varargin(3) == "" + UserSciFilesPaths = []; + else + UserSciFilesPaths = varargin(3); + end + RunMode = varargin(4); + BuildTool = varargin(5); + OutFormat = varargin(6); else // // Calling scilab2c with more than understood values @@ -121,7 +154,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), end if (userchoice == 1) // --- LAUNCH SCI2C --- - runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool); + runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool,OutFormat); end endfunction @@ -132,4 +165,4 @@ function BuildTool = getNativeBuildTool() else BuildTool = "make" end -endfunction \ No newline at end of file +endfunction -- cgit