diff options
Diffstat (limited to '2.3-1/macros/ASTManagement/AST2Ccode.sci')
-rw-r--r-- | 2.3-1/macros/ASTManagement/AST2Ccode.sci | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/2.3-1/macros/ASTManagement/AST2Ccode.sci b/2.3-1/macros/ASTManagement/AST2Ccode.sci index 563f3133..20aa999e 100644 --- a/2.3-1/macros/ASTManagement/AST2Ccode.sci +++ b/2.3-1/macros/ASTManagement/AST2Ccode.sci @@ -11,6 +11,7 @@ function AST2Ccode(FileInfoDatFile) // // Status: // 11-May-2007 -- Raffaele Nutricato: Author. +// 15-June-2017 -- Ukasha Noor: Revised By // // Copyright 2007 Raffaele Nutricato. // Contact: raffaele.nutricato@tiscali.it @@ -42,6 +43,8 @@ load(FileInfo.SharedInfoDatFile,'SharedInfo'); nxtscifunname = SharedInfo.NextSCIFunName; nxtscifunnumber = SharedInfo.NextSCIFunNumber; ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +SharedInfo.Function_list = []; +SharedInfo.Function_list_index = 1; // --------------------------------- // --- Parameter Initialization. --- @@ -64,6 +67,8 @@ STACKDEDUG = 0; // 1 -> Every Pop and Push operation on the stack, the stack con global disp_isthere disp_isthere = 0; + +FName = null // ------------------------------------- // --- End parameter Initialization. --- // ------------------------------------- @@ -144,9 +149,13 @@ while ~meof(fidAST) case 'EndOperation' then [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Operation'); case 'EndFuncall' then + if rc_count > 0 & cc_count == 0 + [EqualInArgName,EqualInArgScope,EqualNInArg,FName] = AST_HandleFuncArray(FileInfo,SharedInfo); + elseif cc_count > 0 + [EqualInArgName,EqualInArgScope,EqualNInArg,FName] = AST_HandleFuncArray2D(FileInfo,SharedInfo); + else [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Funcall'); - disp(disp_isthere); - + end // -------------- // --- Equal. --- // -------------- @@ -156,10 +165,10 @@ while ~meof(fidAST) //NUT: ho miste ins e variabili, per esempio [c(1,1), a] = twooutfun(); //NUT: in questo caso solo una delle due equal va scartata. if rc_count > 0 & cc_count == 0 - [FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo); + [FileInfo,SharedInfo] = AST_HandleFunRC(FName,FileInfo,SharedInfo); rc_count = 0; elseif cc_count > 0 - [FileInfo,SharedInfo] = AST_HandleFunCC(cc_count,FileInfo,SharedInfo); + [FileInfo,SharedInfo] = AST_HandleFunCC(FName,cc_count,FileInfo,SharedInfo); rc_count = 0; cc_count = 0; else @@ -169,12 +178,12 @@ while ~meof(fidAST) end end disp_isthere = 0; + FName = null case 'Equal' then SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block. AST_PushASTStack(treeline); case 'Lhs :' then - disp(disp_isthere); if rc_count > 0 & cc_count == 0 SharedInfo.Equal.Lhs = 1; [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_HandleRC(FileInfo,SharedInfo); @@ -292,6 +301,22 @@ while ~meof(fidAST) AST_PushASTStack(treeline); end end +// ------------------------------------ +// -----List of functions Used-------- +// ------------------------------------- + +SharedInfo.Function_list_index = SharedInfo.Function_list_index - 2; +SharedInfo.Function_list = SharedInfo.Function_list(1:SharedInfo.Function_list_index); +//To remove function repeatedly used---------- +x = size(unique(SharedInfo.Function_list)); +SharedInfo.Function_list_index = x(1); +SharedInfo.Function_list = unique(SharedInfo.Function_list); + +SharedInfo.Function_list = SharedInfo.Function_list(1:SharedInfo.Function_list_index); + + + + // -------------------------------------- // --- End main loop to read the AST. --- // -------------------------------------- |