diff options
author | siddhu8990 | 2017-06-30 11:35:55 +0530 |
---|---|---|
committer | siddhu8990 | 2017-06-30 11:35:55 +0530 |
commit | bee6bf6e37f6c36fb18b6132702e1528b7edafc2 (patch) | |
tree | 1090789e0205f0054c6b31b356b9417c8707176b /macros/ASTManagement/AST_HandleFunRC.sci | |
parent | 2c3b9e1055c8c9dfe874df3b7743c4a765042316 (diff) | |
parent | 7325b038e06f1571402a63caef2d75db30bd13c1 (diff) | |
download | Scilab2C_fossee_old-bee6bf6e37f6c36fb18b6132702e1528b7edafc2.tar.gz Scilab2C_fossee_old-bee6bf6e37f6c36fb18b6132702e1528b7edafc2.tar.bz2 Scilab2C_fossee_old-bee6bf6e37f6c36fb18b6132702e1528b7edafc2.zip |
Matrix declaration modified
Diffstat (limited to 'macros/ASTManagement/AST_HandleFunRC.sci')
-rw-r--r-- | macros/ASTManagement/AST_HandleFunRC.sci | 105 |
1 files changed, 59 insertions, 46 deletions
diff --git a/macros/ASTManagement/AST_HandleFunRC.sci b/macros/ASTManagement/AST_HandleFunRC.sci index a70155a..d316924 100644 --- a/macros/ASTManagement/AST_HandleFunRC.sci +++ b/macros/ASTManagement/AST_HandleFunRC.sci @@ -1,36 +1,17 @@ -function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo) -// function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType) -// ----------------------------------------------------------------- -// #RNU_RES_B -// Handles the EndFuncall, EndOperation and EndEqual tags of the AST. -// ASTFunType can be 'Funcall', 'Operation', 'Equal' -// Structure of Funcall: -// overloading function for "funcall" type tlist string function -// this is a node of the AST -// fields: -// rhs : a list -// name : string, the name of the function -// lhsnb: number, the number of function lhs -// txt=['Funcall : '+F.name -// ' #lhs : '+string(F.lhsnb) -// ' Rhs : ' -// ' '+objectlist2string(F.rhs) -// 'EndFuncall' -// ] -// #RNU_RES_E -// -// Input data: -// //NUT: add description here -// -// Output data: -// //NUT: add description here -// -// Status: -// 11-Apr-2007 -- Raffaele Nutricato: Author. -// -// Copyright 2007 Raffaele Nutricato. -// Contact: raffaele.nutricato@tiscali.it -// ----------------------------------------------------------------- +// 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 + +function [FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo) + +SCI2CNInArgCheck(argn(2),2,2) // ------------------------------ // --- Check input arguments. --- @@ -74,11 +55,16 @@ end RhsField = AST_PopASTStack(); +InputArgumentNames = []; +InputArgumentScope = []; NInArg = 0; InArg = []; while (RhsField ~= 'Expression:') NInArg = NInArg + 1; - InArg(NInArg) = RhsField; + if RhsField <> 'Operands:' + [InputArgumentNames(NInArg),InputArgumentScope(NInArg)] = AST_ExtractNameAndScope(RhsField); + end + //InArg(NInArg) = RhsField; RhsField = AST_PopASTStack(); end InputArgumentNames = SCI2Cflipud(InputArgumentNames); @@ -89,7 +75,6 @@ InputArgumentScope = SCI2Cflipud(InputArgumentScope); // --- Generate the InArg structure. --- // ------------------------------------- //#RNU_RES_E -InArg = []; for counterinputargs = 1:NInArg InArg(counterinputargs).Name=InputArgumentNames(counterinputargs); InArg(counterinputargs).Scope=InputArgumentScope(counterinputargs); @@ -106,6 +91,7 @@ for counteroutputargs = 1:NOutArg OutArg(counteroutputargs).Scope=OutputArgumentScope(counteroutputargs); end + // ------------------------ // --- Print Some Info. --- // ------------------------ @@ -125,8 +111,7 @@ PrintStringInfo('N Output Arguments: '+string(NOutArg),ReportFileName,'file','y' //#RNU_RES_B PrintStringInfo('Output Argument Number '+string(counteroutputargs)+': '+OutArg(counteroutputargs).Name,... ReportFileName,'file','y','n'); - PrintStringInfo(' Scope: '+OutArg(counterinputargs).Scope,... - ReportFileName,'file','y','n'); + //PrintStringInfo(' Scope: '+ OutArg(counterinputargs).Scope,ReportFileName,'file','y','n'); //#RNU_RES_E end @@ -144,22 +129,50 @@ UpdatedInArg = InArg; size_count = 0; for i = 1:NInArg - size_count = size_count + InArg(i).Size(2); + size_count = size_count + eval(InArg(i).Size(2)); end -PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); -OutArg(1).Type = InArg(1).Type; -OutArg(1).Size(1) = '1' -OutArg(1).Size(2) = string(size_count); -OutArg(1).Dimension = InArg(1).Dimension; -OutArg(1).Value = InArg(1).Value; -OutArg(1).FindLike = InArg(1).FindLike; +com_type = 0; +for i = 1:NInArg + if InArg(i).Type == 'z' + com_type = 1; + elseif InArg(i).Type == 'c' + com_type = 2; + end +end + + +if com_type == 0 + PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); + OutArg(1).Type = InArg(1).Type; + OutArg(1).Size(1) = '1' + OutArg(1).Size(2) = string(size_count); + OutArg(1).Dimension = 2; + OutArg(1).Value = InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; +elseif com_type == 1 + PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); + OutArg(1).Type = 'z'; + OutArg(1).Size(1) = '1' + OutArg(1).Size(2) = string(size_count); + OutArg(1).Dimension = 2; + OutArg(1).Value = InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; +else + PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); + OutArg(1).Type = 'c'; + OutArg(1).Size(1) = '1' + OutArg(1).Size(2) = string(size_count); + OutArg(1).Dimension = 2; + OutArg(1).Value = InArg(1).Value; + OutArg(1).FindLike = InArg(1).FindLike; +end //--- Check for output Argument in symbol table ---// OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo); //--- Put the output Argument in symbol table ---// -ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); +ST_InsOutArg_Dup(InArg,NInArg,OutArg,NOutArg,com_type,FileInfo,SharedInfo,'all'); endfunction |