diff options
author | ukashanoor | 2017-06-19 10:42:03 +0530 |
---|---|---|
committer | ukashanoor | 2017-06-19 10:42:03 +0530 |
commit | 5975188ba7090de2d9f646102ab006e1127fd6f8 (patch) | |
tree | 82faad3caaadbe56a07b4a9e874fb80844eac1b2 /2.3-1/macros/CCodeGeneration | |
parent | 02a004ea1500c403ac1a18a52aaf79aaeb7280ed (diff) | |
download | Scilab2C-5975188ba7090de2d9f646102ab006e1127fd6f8.tar.gz Scilab2C-5975188ba7090de2d9f646102ab006e1127fd6f8.tar.bz2 Scilab2C-5975188ba7090de2d9f646102ab006e1127fd6f8.zip |
after if and for
Diffstat (limited to '2.3-1/macros/CCodeGeneration')
27 files changed, 52 insertions, 11 deletions
diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differnew file mode 100644 index 00000000..b4005914 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/2.3-1/macros/CCodeGeneration/C_ForExpression.bin b/2.3-1/macros/CCodeGeneration/C_ForExpression.bin Binary files differnew file mode 100644 index 00000000..1c3f6747 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_ForExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.bin b/2.3-1/macros/CCodeGeneration/C_Funcall.bin Binary files differnew file mode 100644 index 00000000..80fda7c4 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differnew file mode 100644 index 00000000..c3b36009 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin Binary files differnew file mode 100644 index 00000000..1b723f16 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin b/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin Binary files differnew file mode 100644 index 00000000..587c1547 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differnew file mode 100644 index 00000000..cea86411 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin Binary files differnew file mode 100644 index 00000000..838c674e --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin b/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin Binary files differnew file mode 100644 index 00000000..2e02cae4 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin Binary files differnew file mode 100644 index 00000000..332e89bf --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IfExpression.bin b/2.3-1/macros/CCodeGeneration/C_IfExpression.bin Binary files differnew file mode 100644 index 00000000..b1dc7370 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IfExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IfExpression.sci b/2.3-1/macros/CCodeGeneration/C_IfExpression.sci index 48a05383..c723d95a 100644 --- a/2.3-1/macros/CCodeGeneration/C_IfExpression.sci +++ b/2.3-1/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/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin b/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin Binary files differnew file mode 100644 index 00000000..77bfaebc --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin Binary files differnew file mode 100644 index 00000000..567822c0 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin b/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin Binary files differnew file mode 100644 index 00000000..443ad3c1 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin diff --git a/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin b/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin Binary files differnew file mode 100644 index 00000000..1d3e6182 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Type.bin b/2.3-1/macros/CCodeGeneration/C_Type.bin Binary files differnew file mode 100644 index 00000000..7b5bf444 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_Type.bin diff --git a/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin b/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin Binary files differnew file mode 100644 index 00000000..5e426505 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci b/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci index edd2830e..d7cf70ec 100644 --- a/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci +++ b/2.3-1/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/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin b/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin Binary files differnew file mode 100644 index 00000000..6a374f5b --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin diff --git a/2.3-1/macros/CCodeGeneration/GetClsFileName.bin b/2.3-1/macros/CCodeGeneration/GetClsFileName.bin Binary files differnew file mode 100644 index 00000000..dda02933 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetClsFileName.bin diff --git a/2.3-1/macros/CCodeGeneration/GetClsFileName.sci b/2.3-1/macros/CCodeGeneration/GetClsFileName.sci index 46f08201..d92a431c 100644 --- a/2.3-1/macros/CCodeGeneration/GetClsFileName.sci +++ b/2.3-1/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/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin b/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin Binary files differnew file mode 100644 index 00000000..5c73f435 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin diff --git a/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin b/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin Binary files differnew file mode 100644 index 00000000..6815fb4b --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin diff --git a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin Binary files differnew file mode 100644 index 00000000..084ab085 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin diff --git a/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin b/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin Binary files differnew file mode 100644 index 00000000..95fe5611 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib Binary files differindex 2db4b8c8..b62a6c72 100644 --- a/2.3-1/macros/CCodeGeneration/lib +++ b/2.3-1/macros/CCodeGeneration/lib |