diff options
author | yash1112 | 2017-07-07 22:03:16 +0530 |
---|---|---|
committer | yash1112 | 2017-07-07 22:03:16 +0530 |
commit | 69c573fe2e59236f063aaa94dcd44b556f945cbc (patch) | |
tree | 08fa381bec620e38c7a3d2a34448d30160d861eb /macros/ASTManagement/AST_HandleWhileStatem.sci | |
parent | 87823db220f4c3b8bee16c0b2e08027704de1efe (diff) | |
parent | 3f52712f806fbd80d66dfdcaff401e5cf94dcca4 (diff) | |
download | Scilab2C_fossee_old-69c573fe2e59236f063aaa94dcd44b556f945cbc.tar.gz Scilab2C_fossee_old-69c573fe2e59236f063aaa94dcd44b556f945cbc.tar.bz2 Scilab2C_fossee_old-69c573fe2e59236f063aaa94dcd44b556f945cbc.zip |
Scilab2C Arduino Updated
Diffstat (limited to 'macros/ASTManagement/AST_HandleWhileStatem.sci')
-rw-r--r-- | macros/ASTManagement/AST_HandleWhileStatem.sci | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/macros/ASTManagement/AST_HandleWhileStatem.sci b/macros/ASTManagement/AST_HandleWhileStatem.sci index d8c2f73..9b5dce1 100644 --- a/macros/ASTManagement/AST_HandleWhileStatem.sci +++ b/macros/ASTManagement/AST_HandleWhileStatem.sci @@ -36,8 +36,11 @@ global SCI2CSTACK global StackPosition; global STACKDEDUG +<<<<<<< HEAD IfCondArg = []; NIfCondArg = 0; +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ------------------------------ // --- Check input arguments. --- @@ -72,6 +75,7 @@ PrintStringInfo(' Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPa // --- Generate C code. --- // ------------------------ //#RNU_RES_E +<<<<<<< HEAD flagendpop = 0; IfExprField = AST_PopASTStack(); @@ -106,6 +110,38 @@ end IfCondArg = SCI2Cflipud(IfCondArg); SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo); +======= +if(SharedInfo.WhileExpr.CondVar == '') + //#RNU_RES_B + // It means that we are handling something like while(a) or while(1) + // The while condition variable is generated by the HandleEndGenFun. + //#RNU_RES_E + + // --- Pop the name of the condition variable or number. --- + Pop1 = AST_PopASTStack(); + + [ArgName,ArgScope] = AST_ExtractNameAndScope(Pop1); + if (length(ArgName) == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Expected while(variable) or while(number).','','stdout','y'); + PrintStringInfo('SCI2CERROR: Expected a variable or number in the AST while expression.','','stdout','y'); + PrintStringInfo('SCI2CERROR: Report this error to http://forge.scilab.org/index.php/p/scilab2c/issues/.','','stdout','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + error(9999, 'Expected a conditional variable in the while expression'); + end + + SharedInfo.WhileExpr.CondVar = ArgName; + //#RNU_RES_B + // --- Repush strings into the AST stack. --- + //#RNU_RES_E + + AST_PushASTStack(Pop1); + +elseif (SharedInfo.WhileExpr.DimCondVar > 0) + error(9999, 'Cannot manage while with matrix conditions'); +end +SharedInfo = C_WhileExpression(FileInfo,SharedInfo); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // -------------------------- // --- Update SharedInfo. --- |