From fe32d3a31c1f9d26cbefad9e2512a641ef323f0a Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Tue, 29 Mar 2016 22:11:40 +0530 Subject: Function conversion using scilab2c call (not working) --- macros/ASTManagement/AST_HandleEndGenFun.bin | Bin 81800 -> 84704 bytes macros/ASTManagement/AST_HandleEndGenFun.sci | 20 ++- macros/ASTManagement/AST_HandleHeader.bin | Bin 38100 -> 40524 bytes macros/ASTManagement/AST_HandleHeader.sci | 21 ++- macros/CCodeGeneration/lib | Bin 1180 -> 1184 bytes macros/FunctionAnnotation/FA_GetFunAnn.bin | Bin 30676 -> 30684 bytes macros/FunctionAnnotation/FA_GetFunAnn.sci | 2 + macros/FunctionAnnotation/FA_GetOutArgInfo.bin | Bin 16720 -> 16720 bytes macros/FunctionAnnotation/FA_GetOutArgInfo.sci | 6 +- macros/SymbolTable/ST_MatchSymbol.bin | Bin 9116 -> 9112 bytes macros/SymbolTable/ST_MatchSymbol.sci | 1 - macros/ToolInitialization/INIT_GenSharedInfo.bin | Bin 19080 -> 20052 bytes macros/ToolInitialization/INIT_GenSharedInfo.sci | 6 + macros/ToolInitialization/INIT_RemoveDirs.bin | Bin 12372 -> 12532 bytes macros/ToolInitialization/INIT_RemoveDirs.sci | 4 +- macros/findDeps/getAllHeaders.bin | Bin 28508 -> 28508 bytes macros/findDeps/getAllHeaders.sci | 4 +- macros/findDeps/getAllInterfaces.bin | Bin 29568 -> 29568 bytes macros/findDeps/getAllInterfaces.sci | 4 +- macros/findDeps/getAllSources.bin | Bin 171448 -> 171448 bytes macros/findDeps/getAllSources.sci | 4 +- macros/runsci2c.bin | Bin 28568 -> 28916 bytes macros/runsci2c.sci | 164 ++++++++++++----------- macros/scilab2c.bin | Bin 19488 -> 20056 bytes macros/scilab2c.sci | 12 +- 25 files changed, 140 insertions(+), 108 deletions(-) diff --git a/macros/ASTManagement/AST_HandleEndGenFun.bin b/macros/ASTManagement/AST_HandleEndGenFun.bin index 13eec96..5baa2e2 100644 Binary files a/macros/ASTManagement/AST_HandleEndGenFun.bin and b/macros/ASTManagement/AST_HandleEndGenFun.bin differ diff --git a/macros/ASTManagement/AST_HandleEndGenFun.sci b/macros/ASTManagement/AST_HandleEndGenFun.sci index 4dfaec9..3a6d225 100644 --- a/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -193,11 +193,15 @@ global STACKDEDUG FileInfo.GlobalVarFileName); end else - //Change the scope of function name from variable to string, - //as it is passed as string to C function. Also enter this function - //in conversion list also. + //If a function is passed as input argument, Change the scope of function name from variable to string, + //as it is passed as string to C function. Also enter this function in conversion list also. if(ASTFunName == 'ode') - InArg(4).Scope = 'String'; + disp(NInArg) + if NInArg == 4 + InArg(4).Scope = 'String'; + ODEFunName = InArg(4).Name; + disp(ODEFunName) + end end [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo); end @@ -469,4 +473,12 @@ global STACKDEDUG //NUT: e' piu' ordinato. //#RNU_RES_E + //If current function being converted is 'ode', call 'scilab2c' again to convert + //function containing differential equations. It is passed as one of the input + //arguements to 'ode'. + if ASTFunName == 'ode' then + temp = ODEFunName + '.sci' + scilab2c( '/home/siddhesh/Documents/Scilab/ODE/ODE_test/try_ode.sci', FileInfo.OutCCCodeDir, FileInfo.UserSciFilesPaths,'FunCall','make','AVR') + end + endfunction diff --git a/macros/ASTManagement/AST_HandleHeader.bin b/macros/ASTManagement/AST_HandleHeader.bin index b2ef857..b5e33b6 100644 Binary files a/macros/ASTManagement/AST_HandleHeader.bin and b/macros/ASTManagement/AST_HandleHeader.bin differ diff --git a/macros/ASTManagement/AST_HandleHeader.sci b/macros/ASTManagement/AST_HandleHeader.sci index 661c740..7346f32 100644 --- a/macros/ASTManagement/AST_HandleHeader.sci +++ b/macros/ASTManagement/AST_HandleHeader.sci @@ -95,7 +95,6 @@ else NOutArg = size(OutNames,1); end - //#RNU_RES_B // ------------------------------------- // --- Load the C function dat file. --- @@ -108,6 +107,16 @@ load(fullfile(FileInfo.FunctionList.FunInfoDatDir,SharedInfo.NextCFunName+'.dat' SharedInfo.CurrentFunInfo = FunInfo; clear FunInfo +//Required if single file is being translated and has input/outputs +if(SharedInfo.RunMode == "FunCall") +[FunTypeAnnot,FunSizeAnnot] = FA_GetFunAnn(NInArg,NOutArg,FunctionName,FileInfo,SharedInfo); + if((nxtscifunname == SharedInfo.SCIMainFunName)) + SharedInfo.CurrentFunInfo.FunTypeAnnot = FunTypeAnnot; + SharedInfo.CurrentFunInfo.FunSizeAnnot = FunSizeAnnot; + end + disp(SharedInfo.CurrentFunInfo.FunSizeAnnot) + disp(SharedInfo.CurrentFunInfo.FunTypeAnnot) +end //#RNU_RES_B // ----------------------------------------------------------------------------- // --- Check coherence between In/Out names and In/Out Arg structure loaded. --- @@ -119,13 +128,15 @@ else NInArgDat = 0; end -if (NInArgDat == NInArg) + +if ((NInArgDat == NInArg)|(nxtscifunname == SharedInfo.SCIMainFunName)) for tmpcnt = 1:NInArg SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name = InNames(tmpcnt); if (SharedInfo.CurrentFunInfo.InArg(tmpcnt).Dimension == 0) SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(1) = '1'; SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(2) = '1'; SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value = %nan; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).FindLike = 0; else //#RNU_RES_B //NUT: using approach 1: Setting for input and output arguments symbolic sizes. @@ -133,14 +144,14 @@ if (NInArgDat == NInArg) SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(1) = '__'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'Size[0]'; SharedInfo.CurrentFunInfo.InArg(tmpcnt).Size(2) = '__'+SharedInfo.CurrentFunInfo.InArg(tmpcnt).Name+'Size[1]'; SharedInfo.CurrentFunInfo.InArg(tmpcnt).Value = %nan; + SharedInfo.CurrentFunInfo.InArg(tmpcnt).FindLike = 0; end end else error(9999, 'Number of input arguments specified in AST is different from the number specified in .dat file.'); end - -if (SharedInfo.CurrentFunInfo.NOutArg == NOutArg) +if ((SharedInfo.CurrentFunInfo.NOutArg == NOutArg)|(nxtscifunname == SharedInfo.SCIMainFunName)) for tmpcnt = 1:NOutArg SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name = OutNames(tmpcnt); end @@ -160,7 +171,6 @@ SharedInfo.CurrentFunInfo.OutArg = ... SharedInfo,... SharedInfo.CurrentFunInfo.FunPrecSpecifier,... SharedInfo.CurrentFunInfo.FunTypeAnnot,SharedInfo.CurrentFunInfo.FunSizeAnnot,ReportFileName); - //#RNU_RES_B // ------------------------------------------------------------------------- // --- Stores InArg structure into the temporary variables symbol table. --- @@ -206,7 +216,6 @@ for tmpcnt = 1:NOutArg PrintStringInfo(' Setting symbol ""'+SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name+'"" in '+SymbTableFileName+'.',ReportFileName,'file','y'); //#RNU_RES_E - ST_Set(SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Name,... SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Type,... SharedInfo.CurrentFunInfo.OutArg(tmpcnt).Size,... diff --git a/macros/CCodeGeneration/lib b/macros/CCodeGeneration/lib index f91bc26..9007df7 100644 Binary files a/macros/CCodeGeneration/lib and b/macros/CCodeGeneration/lib differ diff --git a/macros/FunctionAnnotation/FA_GetFunAnn.bin b/macros/FunctionAnnotation/FA_GetFunAnn.bin index d3ca8c0..c94c675 100644 Binary files a/macros/FunctionAnnotation/FA_GetFunAnn.bin and b/macros/FunctionAnnotation/FA_GetFunAnn.bin differ diff --git a/macros/FunctionAnnotation/FA_GetFunAnn.sci b/macros/FunctionAnnotation/FA_GetFunAnn.sci index e5fb8ac..ffdfa7f 100644 --- a/macros/FunctionAnnotation/FA_GetFunAnn.sci +++ b/macros/FunctionAnnotation/FA_GetFunAnn.sci @@ -194,6 +194,8 @@ else end end end + + end // --- End loop over the lines of the input file. --- mclose(inclsfid); diff --git a/macros/FunctionAnnotation/FA_GetOutArgInfo.bin b/macros/FunctionAnnotation/FA_GetOutArgInfo.bin index 39d97b2..51ec64c 100644 Binary files a/macros/FunctionAnnotation/FA_GetOutArgInfo.bin and b/macros/FunctionAnnotation/FA_GetOutArgInfo.bin differ diff --git a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci index 37e6d09..5db2623 100644 --- a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci +++ b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -46,17 +46,18 @@ for cntin = 1:NInArg end end DefaultPrecision = SharedInfo.DefaultPrecision; - // --------------------------- // --- End Initialization. --- // --------------------------- if (FunTypeAnnot(1) == '') NOutArg = 0; + else NOutArg = max(size(FunTypeAnnot)); end flagfindlike = 0; + for counterin = 1:NInArg if (InArg(counterin).FindLike == 1 | InArg(counterin).FindLike == -1) // #RNU_RES_B @@ -68,9 +69,8 @@ for counterin = 1:NInArg flagfindlike = -1; end end - for counterout = 1:NOutArg - + if(FunTypeAnnot == 'FA_TP_USER') UpdatedOutArg(counterout).Type = FA_TP_USER(FunPrecSpecifier,DefaultPrecision); else diff --git a/macros/SymbolTable/ST_MatchSymbol.bin b/macros/SymbolTable/ST_MatchSymbol.bin index bf3fb98..278560d 100644 Binary files a/macros/SymbolTable/ST_MatchSymbol.bin and b/macros/SymbolTable/ST_MatchSymbol.bin differ diff --git a/macros/SymbolTable/ST_MatchSymbol.sci b/macros/SymbolTable/ST_MatchSymbol.sci index 20f0bbe..504379c 100644 --- a/macros/SymbolTable/ST_MatchSymbol.sci +++ b/macros/SymbolTable/ST_MatchSymbol.sci @@ -34,7 +34,6 @@ TBFlagEqualSymbols = 0; // --- Find symbol (If exists). --- [TBFlagfound,tmpType,tmpSize,tmpValue,tmpFindLike,tmpDimension] = ... ST_Get(TBName,SymbolTableFileName); - if (TBFlagfound == 1) if (tmpType == 'GBLToBeDefined') TBFlagfound = 2; diff --git a/macros/ToolInitialization/INIT_GenSharedInfo.bin b/macros/ToolInitialization/INIT_GenSharedInfo.bin index eed0cd8..8a5667d 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 c213db9..c24d4a1 100644 --- a/macros/ToolInitialization/INIT_GenSharedInfo.sci +++ b/macros/ToolInitialization/INIT_GenSharedInfo.sci @@ -49,6 +49,8 @@ SharedInfo.NextSCIFileName = UserScilabMainFile; SharedInfo.SCIMainFunName = funname; if (Target == 'Arduino') SharedInfo.CMainFunName = 'loop_arduino'; +elseif (RunMode == 'Translate') + SharedInfo.CMainFunName = funname; else SharedInfo.CMainFunName = 'main'; end @@ -67,6 +69,10 @@ SharedInfo.Annotations.FUNTYPE = '''OUT(''+string(SCI2C_nout)+'').TP='''; // Ty SharedInfo.Annotations.FUNSIZE = '''OUT(''+string(SCI2C_nout)+'').SZ(''+string(SCI2C_nelem)+'')= '''; SharedInfo.Annotations.FUNCLASS = 'CLASS: '; SharedInfo.Annotations.USERFUN = '//SCI2C: '; +SharedInfo.Annotations.INTYPE = '''IN(''+string(SCI2C_nout)+'').TP='''; // Type includes also precision. +SharedInfo.Annotations.INSIZE = '''IN(''+string(SCI2C_nout)+'').SZ(''+string(SCI2C_nelem)+'')= '''; + + // #RNU_RES_B // Note when you execute the following code: // SCI2C_nout=1; diff --git a/macros/ToolInitialization/INIT_RemoveDirs.bin b/macros/ToolInitialization/INIT_RemoveDirs.bin index ac8f708..c1ee9ec 100644 Binary files a/macros/ToolInitialization/INIT_RemoveDirs.bin and b/macros/ToolInitialization/INIT_RemoveDirs.bin differ diff --git a/macros/ToolInitialization/INIT_RemoveDirs.sci b/macros/ToolInitialization/INIT_RemoveDirs.sci index 93ebafb..4d72ab7 100644 --- a/macros/ToolInitialization/INIT_RemoveDirs.sci +++ b/macros/ToolInitialization/INIT_RemoveDirs.sci @@ -62,7 +62,9 @@ elseif (SharedInfoRunMode == 'Translate') rmdir(FileInfo.OutCCCodeDir,'s'); else SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.OutCCCodeDir); - end + end +elseif (SharedInfoRunMode == 'FunCall') + //Do nothing else disp('Unknown RunMode: ""'+SharedInfoRunMode+'"".'); disp('Please check RunMode parameter in the SCI2CInputParameters.sce file'); diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin index 3c3b937..3f2bf2d 100644 Binary files a/macros/findDeps/getAllHeaders.bin and b/macros/findDeps/getAllHeaders.bin differ diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index d97d04c..6338fe2 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -135,8 +135,8 @@ function allHeaders = getAllHeaders(Target) "src/c/signalProcessing/includes/dynlib_signalprocessing.h" "src/c/signalProcessing/includes/crossCorr.h" "src/c/implicitList/dynlib_implicitlist.h" - "src/c/implicitList/implicitList.h" - "src/c/differential_calculus/includes/ode.h"]; + "src/c/implicitList/implicitList.h"]; + //"src/c/differential_calculus/includes/ode.h"]; //Header files required for "Arduino" output Arduino_headers = [ diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin index b0b5334..0121eb9 100644 Binary files a/macros/findDeps/getAllInterfaces.bin and b/macros/findDeps/getAllInterfaces.bin differ diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 9818071..5bef0c6 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -129,8 +129,8 @@ function allInterfaces = getAllInterfaces(Target) "src/c/signalProcessing/interfaces/int_fftshift.h" "src/c/signalProcessing/interfaces/int_fft.h" "src/c/signalProcessing/interfaces/int_lev.h" - "src/c/implicitList/int_OpColon.h" - "src/c/differential_calculus/interfaces/int_ode.h"]; + "src/c/implicitList/int_OpColon.h"]; + //"src/c/differential_calculus/interfaces/int_ode.h"]; //Interface files required for "Arduino" output Arduino_interfaces = [ diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin index a25aa61..0796a3b 100644 Binary files a/macros/findDeps/getAllSources.bin and b/macros/findDeps/getAllSources.bin differ diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 8fc0d31..631edd2 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -897,8 +897,8 @@ function allSources = getAllSources(Target) "src/c/implicitList/zimplicitLists.c" "src/c/implicitList/dimplicitLists.c" "src/c/implicitList/cimplicitLists.c" - "src/c/implicitList/simplicitLists.c" - "src/c/differential_calculus/ode/ode.c"]; + "src/c/implicitList/simplicitLists.c"]; + //"src/c/differential_calculus/ode/ode.c"]; //Files to be inserted only if output format selected is 'Arduino'. Arduino_files = ["src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c" diff --git a/macros/runsci2c.bin b/macros/runsci2c.bin index 90bd886..b7eba52 100644 Binary files a/macros/runsci2c.bin and b/macros/runsci2c.bin differ diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index 41495cb..83cf708 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -74,7 +74,7 @@ INIT_LoadLibraries(FileInfoDatFile); // ---------------------------------- // --- Perform SCI2C Translation. --- // ---------------------------------- -if (RunMode == 'All' | RunMode == 'Translate') +if (RunMode == 'All' | RunMode == 'Translate' | RunMode == "FunCall") FlagContinueTranslation = 1; while(FlagContinueTranslation == 1) UpdateSCI2CInfo(FileInfoDatFile); @@ -90,93 +90,95 @@ end // --------------------------- // --- Copy library files. --- // --------------------------- -global SCI2CHOME - -allSources = SCI2CHOME + "/" + getAllSources(Target); -allHeaders = SCI2CHOME + "/" +getAllHeaders(Target); -allInterfaces = SCI2CHOME + "/" + getAllInterfaces(Target); -allLibraries = SCI2CHOME + "/" + getAllLibraries(Target); - -mkdir(SCI2COutputPath+"/src/"); -mkdir(SCI2COutputPath+"/src/c/"); -mkdir(SCI2COutputPath+"/includes/"); -mkdir(SCI2COutputPath+"/interfaces/"); -mkdir(SCI2COutputPath+"/libraries/"); - -// -- Sources -PrintStepInfo('Copying sources', FileInfo.GeneralReport,'both'); -for i = 1:size(allSources, "*") - // DEBUG only - //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/"); - copyfile(allSources(i), SCI2COutputPath+"/src/c/"); -end - -// -- Includes -PrintStepInfo('Copying headers', FileInfo.GeneralReport,'both'); -for i = 1:size(allHeaders, "*") - // DEBUG only - //disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/"); - copyfile(allHeaders(i), SCI2COutputPath+"/includes/"); -end - -// -- Interfaces -PrintStepInfo('Copying interfaces', FileInfo.GeneralReport,'both'); -for i = 1:size(allInterfaces, "*") - // DEBUG only - //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/"); - copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/"); -end - -// -- Libraries -PrintStepInfo('Copying libraries', FileInfo.GeneralReport,'both'); -for i = 1:size(allLibraries, "*") - // DEBUG only - //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/"); - copyfile(allLibraries(i), SCI2COutputPath+"/libraries/"); -end +if(RunMode <> "FunCall") + + global SCI2CHOME + + allSources = SCI2CHOME + "/" + getAllSources(Target); + allHeaders = SCI2CHOME + "/" +getAllHeaders(Target); + allInterfaces = SCI2CHOME + "/" + getAllInterfaces(Target); + allLibraries = SCI2CHOME + "/" + getAllLibraries(Target); + + mkdir(SCI2COutputPath+"/src/"); + mkdir(SCI2COutputPath+"/src/c/"); + mkdir(SCI2COutputPath+"/includes/"); + mkdir(SCI2COutputPath+"/interfaces/"); + mkdir(SCI2COutputPath+"/libraries/"); + + // -- Sources + PrintStepInfo('Copying sources', FileInfo.GeneralReport,'both'); + for i = 1:size(allSources, "*") + // DEBUG only + //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/"); + copyfile(allSources(i), SCI2COutputPath+"/src/c/"); + 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 (Target == 'Arduino') - - GenerateSetupFunction(FileInfo); - mkdir(SCI2COutputPath+"/arduino/"); - mkdir(SCI2COutputPath+"/arduino/sci2c_arduino"); - //Copy arduino makefile - arduinoFiles = SCI2CHOME + "/" + getArduinoFiles(); - PrintStepInfo('Copying arduino files', FileInfo.GeneralReport,'both'); - copyfile(arduinoFiles(1), SCI2COutputPath); - for i = 2:size(arduinoFiles, "*") - // DEBUG only - //disp("Copying "+arduinoFiles(i)+" in "+SCI2COutputPath+"/arduino/sci2carduino"); - copyfile(arduinoFiles(i), SCI2COutputPath+"/arduino/sci2c_arduino/"); - end + // -- Includes + PrintStepInfo('Copying headers', FileInfo.GeneralReport,'both'); + for i = 1:size(allHeaders, "*") + // DEBUG only + //disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/"); + copyfile(allHeaders(i), SCI2COutputPath+"/includes/"); + end -else + // -- Interfaces + PrintStepInfo('Copying interfaces', FileInfo.GeneralReport,'both'); + for i = 1:size(allInterfaces, "*") + // DEBUG only + //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/"); + copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/"); + end - if BuildTool == "make" - C_GenerateMakefile(FileInfo,SharedInfo); - copyBlasLapackLibs(FileInfo,SharedInfo); //Previously .dll files and blas,lapack library not creating for cygwin by additing this works fine - end - if BuildTool == "nmake" - copyBlasLapackLibs(FileInfo,SharedInfo); - C_GenerateMakefile_msvc(FileInfo,SharedInfo); - end -end + // -- Libraries + PrintStepInfo('Copying libraries', FileInfo.GeneralReport,'both'); + for i = 1:size(allLibraries, "*") + // DEBUG only + //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/"); + copyfile(allLibraries(i), SCI2COutputPath+"/libraries/"); + 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 (Target == 'Arduino') + + GenerateSetupFunction(FileInfo); + mkdir(SCI2COutputPath+"/arduino/"); + mkdir(SCI2COutputPath+"/arduino/sci2c_arduino"); + //Copy arduino makefile + arduinoFiles = SCI2CHOME + "/" + getArduinoFiles(); + PrintStepInfo('Copying arduino files', FileInfo.GeneralReport,'both'); + copyfile(arduinoFiles(1), SCI2COutputPath); + for i = 2: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); + copyBlasLapackLibs(FileInfo,SharedInfo); //Previously .dll files and blas,lapack library not creating for cygwin by additing this works fine + end + if BuildTool == "nmake" + copyBlasLapackLibs(FileInfo,SharedInfo); + C_GenerateMakefile_msvc(FileInfo,SharedInfo); + end + end -// ------------------------------ -// --- Generate SCI2C Header. --- -// ------------------------------ -// FIXME : Give the user the ability to set this prefix -FunctionPrefix = "SCI2C"; -C_GenerateSCI2CHeader(SCI2COutputPath+"/includes/", FunctionPrefix); + // ------------------------------ + // --- Generate SCI2C Header. --- + // ------------------------------ + // FIXME : Give the user the ability to set this prefix + FunctionPrefix = "SCI2C"; + C_GenerateSCI2CHeader(SCI2COutputPath+"/includes/", FunctionPrefix); +end // RunMode <> FunCall // ----------------- // --- Epilogue. --- diff --git a/macros/scilab2c.bin b/macros/scilab2c.bin index ff634b6..91140d1 100644 Binary files a/macros/scilab2c.bin and b/macros/scilab2c.bin differ diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index 118232e..f352d1c 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -66,8 +66,8 @@ function scilab2c(varargin) 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)); + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" & varargin(4) <> "FunCall" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"",""GenLibraryStructure"" or ""FunCall"".\n"),"scilab2c",4)); return end UserScilabMainFile = varargin(1); @@ -87,8 +87,8 @@ function scilab2c(varargin) 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)); + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" & varargin(4) <> "FunCall" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"",""GenLibraryStructure"" or ""FunCall"".\n"),"scilab2c",4)); return end if varargin(5) <> "make" & varargin(5) <> "nmake" @@ -112,8 +112,8 @@ function scilab2c(varargin) 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)); + if varargin(4) <> "All" & varargin(4) <> "Translate" & varargin(4) <> "GenLibraryStructure" & varargin(4) <> "FunCall" + error(msprintf(gettext("%s: argument #%d must be: ""All"", ""Translate"" ,""GenLibraryStructure"" or ""FunCall"".\n"),"scilab2c",4)); return end if varargin(5) <> "make" & varargin(5) <> "nmake" -- cgit