diff options
author | Abhinav Dronamraju | 2017-07-10 22:08:27 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-07-10 22:08:27 +0530 |
commit | d2c00f5343785085bcfefb62cbc041a5cffa8f31 (patch) | |
tree | 3d4fc371c30f2340af2def6dcabeb4fd4821eaf8 /macros/ASTManagement/AST_HandleFuncArray2D.sci | |
parent | c7d123014c05daaa6c7ce32bc5e86e5f3e7e4692 (diff) | |
parent | 49d8281d2da2f4c6bf0e62d148a8a7328d3bf970 (diff) | |
download | Scilab2C_fossee_old-d2c00f5343785085bcfefb62cbc041a5cffa8f31.tar.gz Scilab2C_fossee_old-d2c00f5343785085bcfefb62cbc041a5cffa8f31.tar.bz2 Scilab2C_fossee_old-d2c00f5343785085bcfefb62cbc041a5cffa8f31.zip |
Pulled from upstream master
Diffstat (limited to 'macros/ASTManagement/AST_HandleFuncArray2D.sci')
-rw-r--r-- | macros/ASTManagement/AST_HandleFuncArray2D.sci | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/macros/ASTManagement/AST_HandleFuncArray2D.sci b/macros/ASTManagement/AST_HandleFuncArray2D.sci new file mode 100644 index 0000000..859c994 --- /dev/null +++ b/macros/ASTManagement/AST_HandleFuncArray2D.sci @@ -0,0 +1,69 @@ +// Copyright (C) 2017 - IIT Bombay - FOSSEE + +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Ukasha Noor +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// This function is used for 2D array declaration +// This function extracts the input arguments in the array and check there Name and Scope. +// Then repush everything back to stack +function [RhsNames,RhsScope,NRhs,FName] = AST_HandleFuncArray2D(FileInfo,SharedInfo) + +SCI2CNInArgCheck(argn(2),2,2) + +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ + + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + + +// ------------------------------ +// --- Read input parameters. --- +// ------------------------------ +cntpop = 1; +NRhs = 0; +RhsField(cntpop) = AST_PopASTStack(); +RhsNames = []; +while (RhsField(cntpop) ~= 'Rhs :') + if RhsField(cntpop) <> 'Operands:' & RhsField(cntpop) <> 'Begin:' + NRhs = NRhs + 1; + + [RhsNames(NRhs),RhsScope(NRhs)] = AST_ExtractNameAndScope(RhsField(cntpop)); + end + cntpop = cntpop + 1; + RhsField(cntpop) = AST_PopASTStack(); +end + +first = AST_PopASTStack(); +second = AST_PopASTStack(); + +FName = stripblanks(part(second,12:length(second))); + +RhsNames = SCI2Cflipud(RhsNames); +RhsScope = SCI2Cflipud(RhsScope); + +// --- Repush everything into the stack. --- +for cntpush = cntpop:-1:1 + if RhsField(cntpush) <> 'Operands:' & RhsField(cntpush) <> 'Begin:' & RhsField(cntpush) <> 'Rhs :' + PrintStringInfo(' ' + RhsField(cntpush),ReportFileName,'file','y'); + AST_PushASTStack(RhsField(cntpush)); + end +end + + + + +endfunction |