diff options
Diffstat (limited to 'macros')
24 files changed, 126 insertions, 28 deletions
diff --git a/macros/ASTManagement/AST_HandleEndGenFun.bin b/macros/ASTManagement/AST_HandleEndGenFun.bin Binary files differindex 414942c3..82599f35 100644 --- a/macros/ASTManagement/AST_HandleEndGenFun.bin +++ b/macros/ASTManagement/AST_HandleEndGenFun.bin diff --git a/macros/ASTManagement/AST_HandleEndGenFun.sci b/macros/ASTManagement/AST_HandleEndGenFun.sci index 41c4cb40..0bc12992 100644 --- a/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -205,6 +205,10 @@ global STACKDEDUG SharedInfo.ODElist($+1) = InArg(4).Name; //Add ode function in list. this will be used to add corresponding //header file in main function. + elseif NInArg == 5 + ODEFunName = InArg(5).Name; + InArg(5).Name = 'odefn'+ InArg(5).Name + SharedInfo.ODElist($+1) = InArg(5).Name; end end [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName); @@ -362,9 +366,15 @@ global STACKDEDUG ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); end if ASTFunName == 'ode' then - ODE_InArg(1) = InArg(3) - ODE_InArg(2) = InArg(1) - ODE_OutArg(1) = OutArg(1) + if NInArg == 4 + ODE_InArg(1) = InArg(3) + ODE_InArg(2) = InArg(1) + ODE_OutArg(1) = OutArg(1) + elseif NInArg == 5 then + ODE_InArg(1) = InArg(4) + ODE_InArg(2) = InArg(2) + ODE_OutArg(1) = OutArg(1) + end ODE_CFunName = C_GenerateFunName('odefn'+ODEFunName,ODE_InArg,2,ODE_OutArg,1); //Functions containing differential equations that are used with 'ode' //function need to be handled differently. diff --git a/macros/CCodeGeneration/C_Funcall.bin b/macros/CCodeGeneration/C_Funcall.bin Binary files differindex f54c0c3d..23b9e6f4 100644 --- a/macros/CCodeGeneration/C_Funcall.bin +++ b/macros/CCodeGeneration/C_Funcall.bin diff --git a/macros/CCodeGeneration/C_Funcall.sci b/macros/CCodeGeneration/C_Funcall.sci index eec20c70..22a27709 100644 --- a/macros/CCodeGeneration/C_Funcall.sci +++ b/macros/CCodeGeneration/C_Funcall.sci @@ -222,7 +222,7 @@ if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %F) else TmpInArgName = InArg(counterin).Name; end - + TmpInArgType = C_Type(InArg(counterin).Type); //if (FunctionName == 'OpEqual') @@ -251,8 +251,8 @@ else //function containing odes in specific format which is differnt than generated //above. for counterin = 1:NInArg - - if(counterin <> 3) //Skip third argument + + //if((NInArg == 4 & counterin <> 3) | (NInArg == 5 & counterin <> 4)) //Skip third argument if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String') TmpInArgName = '""'+InArg(counterin).Name+'""'; elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number')) @@ -262,7 +262,7 @@ else else TmpInArgName = InArg(counterin).Name; end - + TmpInArgType = C_Type(InArg(counterin).Type); //if (FunctionName == 'OpEqual') @@ -283,7 +283,7 @@ else CCall = CCall+TmpInArgName+', ';//+TmpInArgSizeVar+','; end end - end + //end end end diff --git a/macros/CCodeGeneration/C_GenDeclarations.bin b/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differindex 1e6c4553..c3b36009 100644 --- a/macros/CCodeGeneration/C_GenDeclarations.bin +++ b/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/macros/CCodeGeneration/C_GenDeclarations.sci b/macros/CCodeGeneration/C_GenDeclarations.sci index eb61723d..41ba3a91 100644 --- a/macros/CCodeGeneration/C_GenDeclarations.sci +++ b/macros/CCodeGeneration/C_GenDeclarations.sci @@ -92,7 +92,7 @@ if (ArgStruct.Dimension > 0) Cdeclaration(2) = Cdeclaration(2)+';'; end else - if (ArgStruct.Type == 'f') + if (ArgStruct.Type == 'fn') //do nothing. This is a function name. Will be declared in header file. else if (FlagExt == 1) diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex 76090baa..3ced74fb 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index fecbf915..94b36964 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -90,10 +90,19 @@ target = SharedInfo.Target; PrintStringInfo('SRC = \\', FileInfo.MakefileFilename,'file','y','y'); allSources = getAllSources(target); nbSources = size(allSources); + for i = 1:(nbSources(1) - 1) [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); - PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); + + if(~isempty(strstr(allSources(i),'ode'))) + if(size(SharedInfo.ODElist) <> 0) + PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); + end + else + PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); + end end + [tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, FileInfo.MakefileFilename,'file','y','y'); diff --git a/macros/CCodeGeneration/C_Type.bin b/macros/CCodeGeneration/C_Type.bin Binary files differindex 64037d45..18e0a1b2 100644 --- a/macros/CCodeGeneration/C_Type.bin +++ b/macros/CCodeGeneration/C_Type.bin diff --git a/macros/CCodeGeneration/C_Type.sci b/macros/CCodeGeneration/C_Type.sci index 506c8fde..6e9a295c 100644 --- a/macros/CCodeGeneration/C_Type.sci +++ b/macros/CCodeGeneration/C_Type.sci @@ -34,7 +34,7 @@ elseif (ArgType == 'i') elseif (ArgType == 'g') OutC_Type = 'char'; elseif (ArgType == 'f') - OutC_Type = 'SCI2CFILEID'; + OutC_Type = 'FILE *'; elseif (ArgType == 'u8') OutC_Type = 'uint8'; elseif (ArgType == 'i8') @@ -43,6 +43,9 @@ elseif (ArgType == 'u16') OutC_Type = 'uint16'; elseif (ArgType == 'i16') OutC_Type = 'int16'; +elseif (ArgType == 'fn') //This type introduced for ODE function, + // as it's one of the inout argument is name of the other function + OutC_Type = ''; else error(9999, 'Unknown Argument Type: ""'+ArgType+'"".'); end diff --git a/macros/SymbolTable/ST_GetInArgInfo.bin b/macros/SymbolTable/ST_GetInArgInfo.bin Binary files differindex 61be39aa..bb7119ad 100644 --- a/macros/SymbolTable/ST_GetInArgInfo.bin +++ b/macros/SymbolTable/ST_GetInArgInfo.bin diff --git a/macros/SymbolTable/ST_GetInArgInfo.sci b/macros/SymbolTable/ST_GetInArgInfo.sci index 5f1a6cfc..72e96dd9 100644 --- a/macros/SymbolTable/ST_GetInArgInfo.sci +++ b/macros/SymbolTable/ST_GetInArgInfo.sci @@ -134,7 +134,18 @@ for cntinarg = 1:NInArg if(NInArg == 4 & cntinarg == 4)
//incase of 4 arguments, fourth argument is function name
UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
- UpdatedInArg(cntinarg).Type = 'f'; //it is a function name
+ UpdatedInArg(cntinarg).Type = 'fn'; //it is a function name
+ UpdatedInArg(cntinarg).Size(1) = '1';
+ UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
+ UpdatedInArg(cntinarg).Value = '&'+tmpname;
+ UpdatedInArg(cntinarg).FindLike = 0;
+ UpdatedInArg(cntinarg).Dimension = 0; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Scope = 'Temp';
+ ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
+ elseif (NInArg == 5 & cntinarg == 5) then
+ //incase of 5 arguments, fifth argument is function name
+ UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
+ UpdatedInArg(cntinarg).Type = 'fn'; //it is a function name
UpdatedInArg(cntinarg).Size(1) = '1';
UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
UpdatedInArg(cntinarg).Value = '&'+tmpname;
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex dce28bc5..8a5a3264 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 2d6c99c5..6507e615 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -3352,10 +3352,27 @@ PrintStringInfo('s0g2f0'+ArgSeparator,ClassFileName,'file','y'); PrintStringInfo('s2g2f0'+ArgSeparator,ClassFileName,'file','y');
PrintStringInfo('d0g2f0'+ArgSeparator,ClassFileName,'file','y');
PrintStringInfo('d2g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('u80g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('u82g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('i80g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('i82g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('u160g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('u162g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('i160g2f0'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('i162g2f0'+ArgSeparator,ClassFileName,'file','y');
+
PrintStringInfo('s0g2f0'+ArgSeparator+'i0',ClassFileName,'file','y'); //NUT la mput e' strana
PrintStringInfo('s2g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
PrintStringInfo('d0g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
PrintStringInfo('d2g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('u80g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('u82g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('i80g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('i82g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('u160g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('u162g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('i160g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
+PrintStringInfo('i162g2f0'+ArgSeparator+'i0',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'mput';
@@ -4853,12 +4870,30 @@ PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); PrintStringInfo('OUT(1).SZ(1)= IN(3).SZ(1)',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(2)= IN(3).SZ(2)',ClassFileName,'file','y');
+//Arguements specified: solver type, initial value, start time, end time, ode function
+PrintStringInfo('NIN= 5',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(2).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_MUL(IN(2).SZ(2),IN(4).SZ(2))',ClassFileName,'file','y');
+
+//Arguements specified: solver type, initial value, start time, end time, ode function
+PrintStringInfo('NIN= 5',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(2).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(4).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(4).SZ(2)',ClassFileName,'file','y');
+
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('d0d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d0d0d0g2'+ArgSeparator+'d0',ClassFileName,'file','y');
-PrintStringInfo('d2d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2d0d0f0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d0d0d0fn0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2d0d0fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d0d02fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d0d2fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('g2d0d0d0fn0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('g2d2d0d0fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('g2d0d02fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('g2d2d0d2fn0'+ArgSeparator+'d2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'ode';
diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin Binary files differindex a053d51a..34ef825a 100644 --- a/macros/findDeps/getAllHeaders.bin +++ b/macros/findDeps/getAllHeaders.bin diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 06ef5487..b5ab4910 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -142,7 +142,8 @@ function allHeaders = getAllHeaders(Target) "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/differential_calculus/includes/ode.h" + "src/c/Files/includes/files.h"]; //Header files required for "Arduino" output Arduino_headers = [ diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin Binary files differindex 53aaebe2..d641e330 100644 --- a/macros/findDeps/getAllInterfaces.bin +++ b/macros/findDeps/getAllInterfaces.bin diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 8fd8f8d9..d1da472f 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -137,7 +137,8 @@ function allInterfaces = getAllInterfaces(Target) "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/differential_calculus/interfaces/int_ode.h" + "src/c/Files/interfaces/int_files.h"]; //Interface files required for "Arduino" output Arduino_interfaces = [ diff --git a/macros/findDeps/getAllLibraries.bin b/macros/findDeps/getAllLibraries.bin Binary files differindex c27e3309..8157de90 100644 --- a/macros/findDeps/getAllLibraries.bin +++ b/macros/findDeps/getAllLibraries.bin diff --git a/macros/findDeps/getAllLibraries.sci b/macros/findDeps/getAllLibraries.sci index 7a8ce276..57cc9dac 100644 --- a/macros/findDeps/getAllLibraries.sci +++ b/macros/findDeps/getAllLibraries.sci @@ -8,6 +8,7 @@ function allLibraries = getAllLibraries(Target) "src/c/hardware/rasberrypi/libraries/librefblas.a" "src/c/hardware/rasberrypi/libraries/liblapack.a" "src/c/hardware/rasberrypi/libraries/libgfortran.a" + "src/c/hardware/rasberrypi/libraries/libgsl.a" ]; if Target == "RPi" @@ -16,5 +17,4 @@ function allLibraries = getAllLibraries(Target) allLibraries = []; end - endfunction diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin Binary files differindex 5a7dc92e..9dfae6f9 100644 --- a/macros/findDeps/getAllSources.bin +++ b/macros/findDeps/getAllSources.bin diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 5cac7bde..726d5ec7 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -955,7 +955,21 @@ function allSources = getAllSources(Target) "src/c/implicitList/cimplicitLists.c" "src/c/implicitList/simplicitLists.c" "src/c/differential_calculus/ode/dodes.c" - "src/c/differential_calculus/ode/dodea.c"]; + "src/c/differential_calculus/ode/dodea.c" + "src/c/Files/mopen/mopen.c" + "src/c/Files/mclose/mclose.c" + "src/c/Files/mput/dmputs.c" + "src/c/Files/mput/smputs.c" + "src/c/Files/mput/u8mputs.c" + "src/c/Files/mput/i8mputs.c" + "src/c/Files/mput/u16mputs.c" + "src/c/Files/mput/i16mputs.c" + "src/c/Files/mput/dmputa.c" + "src/c/Files/mput/smputa.c" + "src/c/Files/mput/u8mputa.c" + "src/c/Files/mput/i8mputa.c" + "src/c/Files/mput/u16mputa.c" + "src/c/Files/mput/i16mputa.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 Binary files differindex 0adbe899..47f5ccd9 100644 --- a/macros/runsci2c.bin +++ b/macros/runsci2c.bin diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index da2ba4d3..7dae72ae 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -95,7 +95,12 @@ global SCI2CHOME allSources = SCI2CHOME + "/" + getAllSources(Target);
allHeaders = SCI2CHOME + "/" +getAllHeaders(Target);
allInterfaces = SCI2CHOME + "/" + getAllInterfaces(Target);
-allLibraries = SCI2CHOME + "/" + getAllLibraries(Target);
+if(~isempty(getAllLibraries(Target)))
+ allLibraries = SCI2CHOME + "/" + getAllLibraries(Target);
+else
+ allLibraries = ''
+end
+//allLibraries = SCI2CHOME + "/" + getAllLibraries(Target);
mkdir(SCI2COutputPath+"/src/");
mkdir(SCI2COutputPath+"/src/c/");
@@ -105,10 +110,18 @@ 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/");
+ //Copy ode related functions only if 'ode' function is used.
+ if(~isempty(strstr(allSources(i),'ode')))
+ if(size(SharedInfo.ODElist) <> 0)
+ copyfile(allSources(i), SCI2COutputPath+"/src/c/");
+ end
+ else
+ copyfile(allSources(i), SCI2COutputPath+"/src/c/");
+ end
end
// -- Includes
@@ -128,13 +141,14 @@ for i = 1:size(allInterfaces, "*") 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/");
+if(~isempty(allLibraries))
+ 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
end
-
// --------------------------
// --- Generate Makefile. ---
// --------------------------
|