diff options
author | ukashanoor | 2017-06-19 10:42:03 +0530 |
---|---|---|
committer | ukashanoor | 2017-06-19 10:42:03 +0530 |
commit | 8e235230a4c16a042d2620fa7b58a9b0f4ba1914 (patch) | |
tree | 455eef81a4fda3d0737ffde5614c333ac8f56ed9 /macros/CCodeGeneration | |
parent | b33afdb2311fbe8aad4c5c614c6098585fe2d279 (diff) | |
download | Scilab2C_fossee_old-8e235230a4c16a042d2620fa7b58a9b0f4ba1914.tar.gz Scilab2C_fossee_old-8e235230a4c16a042d2620fa7b58a9b0f4ba1914.tar.bz2 Scilab2C_fossee_old-8e235230a4c16a042d2620fa7b58a9b0f4ba1914.zip |
after if and for
Diffstat (limited to 'macros/CCodeGeneration')
27 files changed, 52 insertions, 11 deletions
diff --git a/macros/CCodeGeneration/C_FinalizeCode.bin b/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differnew file mode 100644 index 0000000..b400591 --- /dev/null +++ b/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/macros/CCodeGeneration/C_ForExpression.bin b/macros/CCodeGeneration/C_ForExpression.bin Binary files differnew file mode 100644 index 0000000..1c3f674 --- /dev/null +++ b/macros/CCodeGeneration/C_ForExpression.bin diff --git a/macros/CCodeGeneration/C_Funcall.bin b/macros/CCodeGeneration/C_Funcall.bin Binary files differnew file mode 100644 index 0000000..80fda7c --- /dev/null +++ b/macros/CCodeGeneration/C_Funcall.bin diff --git a/macros/CCodeGeneration/C_GenDeclarations.bin b/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differnew file mode 100644 index 0000000..c3b3600 --- /dev/null +++ b/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/macros/CCodeGeneration/C_GenerateFunName.bin b/macros/CCodeGeneration/C_GenerateFunName.bin Binary files differnew file mode 100644 index 0000000..1b723f1 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateFunName.bin diff --git a/macros/CCodeGeneration/C_GenerateLaunchScript.bin b/macros/CCodeGeneration/C_GenerateLaunchScript.bin Binary files differnew file mode 100644 index 0000000..587c154 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateLaunchScript.bin diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differnew file mode 100644 index 0000000..cea8641 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin b/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin Binary files differnew file mode 100644 index 0000000..838c674 --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin diff --git a/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin b/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin Binary files differnew file mode 100644 index 0000000..2e02cae --- /dev/null +++ b/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin diff --git a/macros/CCodeGeneration/C_IfElseBlocks.bin b/macros/CCodeGeneration/C_IfElseBlocks.bin Binary files differnew file mode 100644 index 0000000..332e89b --- /dev/null +++ b/macros/CCodeGeneration/C_IfElseBlocks.bin diff --git a/macros/CCodeGeneration/C_IfExpression.bin b/macros/CCodeGeneration/C_IfExpression.bin Binary files differnew file mode 100644 index 0000000..b1dc737 --- /dev/null +++ b/macros/CCodeGeneration/C_IfExpression.bin diff --git a/macros/CCodeGeneration/C_IfExpression.sci b/macros/CCodeGeneration/C_IfExpression.sci index 48a0538..c723d95 100644 --- a/macros/CCodeGeneration/C_IfExpression.sci +++ b/macros/CCodeGeneration/C_IfExpression.sci @@ -1,4 +1,4 @@ -function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo) +function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,FileInfo,SharedInfo) // function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo) // ----------------------------------------------------------------- // //NUT: add description here @@ -19,12 +19,16 @@ function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo, // ------------------------------ // --- Check input arguments. --- // ------------------------------ -SCI2CNInArgCheck(argn(2),5,5); +//SCI2CNInArgCheck(argn(4),7,7); + +//global SCI2CSTACK +//global StackPosition; +//global STACKDEDUG // --- Check NIfCondArg value. --- -if ((NIfCondArg ~= 1) & (ASTIfExpType~='else')) - error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.'); -end +//if ((NIfCondArg ~= 1) & (ASTIfExpType~='else')) + // error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.'); +//end // ----------------------- // --- Initialization. --- @@ -37,7 +41,7 @@ CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; // #RNU_RES_B PrintStringInfo(' ',ReportFileName,'file','y'); -PrintStringInfo('***Generating C code***',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***'+ string(NIfCondArg),ReportFileName,'file','y'); // #RNU_RES_E // --------------------------- // --- End Initialization. --- @@ -66,10 +70,23 @@ if SCI2Cstrncmps1size(ASTIfExpType,'else') SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out'); end +i=1; +k=1; CCall =''; CCall = CCall+CFunName; if (ASTIfExpType~='else') - CCall = CCall+'('+IfCondArg(1)+')'; + CCall = CCall+'('; + while i <= NIfCondArg + CCall = CCall + IfCondArg(i) + ' '; + //d = modulo(i,3); + //PrintStringInfo(' '+string(i)+string(d),'file','y'); + if (modulo(i,3)==0 & i<>NIfCondArg) + CCall = CCall + Op(k) + ' '; + k = k + 1; + end + i = i + 1; + end + CCall = CCall+')'; end PrintStringInfo(' '+CCall,ReportFileName,'file','y'); PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); diff --git a/macros/CCodeGeneration/C_IndentBlanks.bin b/macros/CCodeGeneration/C_IndentBlanks.bin Binary files differnew file mode 100644 index 0000000..77bfaeb --- /dev/null +++ b/macros/CCodeGeneration/C_IndentBlanks.bin diff --git a/macros/CCodeGeneration/C_InitHeader.bin b/macros/CCodeGeneration/C_InitHeader.bin Binary files differnew file mode 100644 index 0000000..567822c --- /dev/null +++ b/macros/CCodeGeneration/C_InitHeader.bin diff --git a/macros/CCodeGeneration/C_MemAllocOutTempVars.bin b/macros/CCodeGeneration/C_MemAllocOutTempVars.bin Binary files differnew file mode 100644 index 0000000..443ad3c --- /dev/null +++ b/macros/CCodeGeneration/C_MemAllocOutTempVars.bin diff --git a/macros/CCodeGeneration/C_SCI2CHeader.bin b/macros/CCodeGeneration/C_SCI2CHeader.bin Binary files differnew file mode 100644 index 0000000..1d3e618 --- /dev/null +++ b/macros/CCodeGeneration/C_SCI2CHeader.bin diff --git a/macros/CCodeGeneration/C_Type.bin b/macros/CCodeGeneration/C_Type.bin Binary files differnew file mode 100644 index 0000000..7b5bf44 --- /dev/null +++ b/macros/CCodeGeneration/C_Type.bin diff --git a/macros/CCodeGeneration/C_WhileExpression.bin b/macros/CCodeGeneration/C_WhileExpression.bin Binary files differnew file mode 100644 index 0000000..5e42650 --- /dev/null +++ b/macros/CCodeGeneration/C_WhileExpression.bin diff --git a/macros/CCodeGeneration/C_WhileExpression.sci b/macros/CCodeGeneration/C_WhileExpression.sci index edd2830..d7cf70e 100644 --- a/macros/CCodeGeneration/C_WhileExpression.sci +++ b/macros/CCodeGeneration/C_WhileExpression.sci @@ -1,4 +1,4 @@ -function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) +function SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo) // function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) // ----------------------------------------------------------------- // //NUT: add description here @@ -19,7 +19,7 @@ function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) // ------------------------------ // --- Check input arguments. --- // ------------------------------ -SCI2CNInArgCheck(argn(2),2,2); +//SCI2CNInArgCheck(argn(2),2,2); // ----------------------- // --- Initialization. --- @@ -63,7 +63,7 @@ for cntstr = 1:NumCStrings // Epilogue if (length(C_Strings(cntstr)) == 0) C_Strings(cntstr) = ' '; // RNU for Bruno: If I don't do that I get a PrintStringInfo error related to mputstr. - // Function not defined for given argument type(s),
+ // Function not defined for given argument type(s), // check arguments or define function %0_mputstr for overloading. end PrintStringInfo(C_Strings(cntstr),CPass1WhileEpilFileName ,'file','y','n'); @@ -76,7 +76,27 @@ PrintStringInfo('}',CPass1WhileEpilFileName ,'file','y'); // ------------------------------ // --- Insert for expression. --- // ------------------------------ -CCall = 'while('+SharedInfo.WhileExpr.CondVar+')'; +//CCall = 'while('+SharedInfo.WhileExpr.CondVar+')'; +//PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +i=1; +k=1; +CCall =''; +CCall = CCall+'while'; + CCall = CCall+'('; + while i <= NIfCondArg + CCall = CCall + IfCondArg(i) + ' '; + //d = modulo(i,3); + //PrintStringInfo(' '+string(i)+string(d),'file','y'); + if (modulo(i,3)==0 & i<>NIfCondArg) + CCall = CCall + Op(k) + ' '; + k = k + 1; + end + i = i + 1; + end + CCall = CCall+')'; + +PrintStringInfo(' '+CCall,ReportFileName,'file','y'); PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); // ------------------- diff --git a/macros/CCodeGeneration/GenCFunDatFiles.bin b/macros/CCodeGeneration/GenCFunDatFiles.bin Binary files differnew file mode 100644 index 0000000..6a374f5 --- /dev/null +++ b/macros/CCodeGeneration/GenCFunDatFiles.bin diff --git a/macros/CCodeGeneration/GetClsFileName.bin b/macros/CCodeGeneration/GetClsFileName.bin Binary files differnew file mode 100644 index 0000000..dda0293 --- /dev/null +++ b/macros/CCodeGeneration/GetClsFileName.bin diff --git a/macros/CCodeGeneration/GetClsFileName.sci b/macros/CCodeGeneration/GetClsFileName.sci index 46f0820..d92a431 100644 --- a/macros/CCodeGeneration/GetClsFileName.sci +++ b/macros/CCodeGeneration/GetClsFileName.sci @@ -45,6 +45,7 @@ if SCI2Cfileexist(FileInfo.USER2CLibCAnnFun,tmpannfilename) // #RNU_RES_B // It is a C function of the USER2C library. // #RNU_RES_E + PrintStringInfo('cUser2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.USER2CLibCAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -53,6 +54,7 @@ elseif SCI2Cfileexist(FileInfo.USER2CLibSCIAnnFun,tmpannfilename) // #RNU_RES_B // It is a scilab function of the USER2C library. // #RNU_RES_E + PrintStringInfo('fUser2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -61,6 +63,7 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,tmpannfilename)) // #RNU_RES_B // It is a C function of the SCI2C library. // #RNU_RES_E + PrintStringInfo('csci2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.SCI2CLibCAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -69,6 +72,7 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename)) // #RNU_RES_B // It is a scilab function of the SCI2C library. // #RNU_RES_E + PrintStringInfo('fsci2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); diff --git a/macros/CCodeGeneration/GetSymbolDimension.bin b/macros/CCodeGeneration/GetSymbolDimension.bin Binary files differnew file mode 100644 index 0000000..5c73f43 --- /dev/null +++ b/macros/CCodeGeneration/GetSymbolDimension.bin diff --git a/macros/CCodeGeneration/GetWhileCondVariable.bin b/macros/CCodeGeneration/GetWhileCondVariable.bin Binary files differnew file mode 100644 index 0000000..6815fb4 --- /dev/null +++ b/macros/CCodeGeneration/GetWhileCondVariable.bin diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/macros/CCodeGeneration/JoinDeclarAndCcode.bin Binary files differnew file mode 100644 index 0000000..084ab08 --- /dev/null +++ b/macros/CCodeGeneration/JoinDeclarAndCcode.bin diff --git a/macros/CCodeGeneration/Sci2AnnotationFile.bin b/macros/CCodeGeneration/Sci2AnnotationFile.bin Binary files differnew file mode 100644 index 0000000..95fe561 --- /dev/null +++ b/macros/CCodeGeneration/Sci2AnnotationFile.bin diff --git a/macros/CCodeGeneration/lib b/macros/CCodeGeneration/lib Binary files differindex 2db4b8c..b62a6c7 100644 --- a/macros/CCodeGeneration/lib +++ b/macros/CCodeGeneration/lib |