From c75fb67154fb5679d6ede9a52d5f5ae15600f9f9 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Mon, 6 Jun 2016 09:18:33 +0530 Subject: File handling functions added --- macros/CCodeGeneration/C_Funcall.bin | Bin 71780 -> 71972 bytes macros/CCodeGeneration/C_Funcall.sci | 10 +++++----- macros/CCodeGeneration/C_GenDeclarations.bin | Bin 22000 -> 22004 bytes macros/CCodeGeneration/C_GenDeclarations.sci | 2 +- macros/CCodeGeneration/C_GenerateMakefile.bin | Bin 26832 -> 27820 bytes macros/CCodeGeneration/C_GenerateMakefile.sci | 11 ++++++++++- macros/CCodeGeneration/C_Type.bin | Bin 4680 -> 5232 bytes macros/CCodeGeneration/C_Type.sci | 5 ++++- 8 files changed, 20 insertions(+), 8 deletions(-) (limited to 'macros/CCodeGeneration') diff --git a/macros/CCodeGeneration/C_Funcall.bin b/macros/CCodeGeneration/C_Funcall.bin index f54c0c3..23b9e6f 100644 Binary files a/macros/CCodeGeneration/C_Funcall.bin and b/macros/CCodeGeneration/C_Funcall.bin differ diff --git a/macros/CCodeGeneration/C_Funcall.sci b/macros/CCodeGeneration/C_Funcall.sci index eec20c7..22a2770 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 index 1e6c455..c3b3600 100644 Binary files a/macros/CCodeGeneration/C_GenDeclarations.bin and b/macros/CCodeGeneration/C_GenDeclarations.bin differ diff --git a/macros/CCodeGeneration/C_GenDeclarations.sci b/macros/CCodeGeneration/C_GenDeclarations.sci index eb61723..41ba3a9 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 index 76090ba..3ced74fb 100644 Binary files a/macros/CCodeGeneration/C_GenerateMakefile.bin and b/macros/CCodeGeneration/C_GenerateMakefile.bin differ diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index fecbf91..94b3696 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 index 64037d4..18e0a1b 100644 Binary files a/macros/CCodeGeneration/C_Type.bin and b/macros/CCodeGeneration/C_Type.bin differ diff --git a/macros/CCodeGeneration/C_Type.sci b/macros/CCodeGeneration/C_Type.sci index 506c8fd..6e9a295 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 -- cgit