diff options
Diffstat (limited to '2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci')
-rw-r--r-- | 2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci b/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci index d8c2f73c..9b5dce15 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci +++ b/2.3-1/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. --- |