summaryrefslogtreecommitdiff
path: root/macros/ASTManagement/AST2Ccode.sci
diff options
context:
space:
mode:
authorAbhinav Dronamraju2017-07-10 22:08:27 +0530
committerAbhinav Dronamraju2017-07-10 22:08:27 +0530
commitd2c00f5343785085bcfefb62cbc041a5cffa8f31 (patch)
tree3d4fc371c30f2340af2def6dcabeb4fd4821eaf8 /macros/ASTManagement/AST2Ccode.sci
parentc7d123014c05daaa6c7ce32bc5e86e5f3e7e4692 (diff)
parent49d8281d2da2f4c6bf0e62d148a8a7328d3bf970 (diff)
downloadScilab2C_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/AST2Ccode.sci')
-rw-r--r--macros/ASTManagement/AST2Ccode.sci35
1 files changed, 30 insertions, 5 deletions
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci
index 563f313..20aa999 100644
--- a/macros/ASTManagement/AST2Ccode.sci
+++ b/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. ---
// --------------------------------------