summaryrefslogtreecommitdiff
path: root/macros/ASTManagement/AST2Ccode.sci
diff options
context:
space:
mode:
authoryash11122017-07-07 22:34:47 +0530
committeryash11122017-07-07 22:34:47 +0530
commit2340409c98f9b15bb23944b991e97a1aa4e88ce0 (patch)
tree8fa462e65aca52e5e933dee026a78c31baf0181c /macros/ASTManagement/AST2Ccode.sci
parentf577f255fd5c1d30bc770e9b053823ada8684528 (diff)
parent69c573fe2e59236f063aaa94dcd44b556f945cbc (diff)
downloadScilab2C_fossee_old-2340409c98f9b15bb23944b991e97a1aa4e88ce0.tar.gz
Scilab2C_fossee_old-2340409c98f9b15bb23944b991e97a1aa4e88ce0.tar.bz2
Scilab2C_fossee_old-2340409c98f9b15bb23944b991e97a1aa4e88ce0.zip
1.Sci2cDeps updated 2.Windows compatibility resolved
Diffstat (limited to 'macros/ASTManagement/AST2Ccode.sci')
-rw-r--r--macros/ASTManagement/AST2Ccode.sci61
1 files changed, 61 insertions, 0 deletions
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci
index 6fe190e..5cceaf1 100644
--- a/macros/ASTManagement/AST2Ccode.sci
+++ b/macros/ASTManagement/AST2Ccode.sci
@@ -42,10 +42,16 @@ load(FileInfo.SharedInfoDatFile,'SharedInfo');
nxtscifunname = SharedInfo.NextSCIFunName;
nxtscifunnumber = SharedInfo.NextSCIFunNumber;
ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
+<<<<<<< HEAD
+=======
+SharedInfo.Function_list = [];
+SharedInfo.Function_list_index = 1;
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// ---------------------------------
// --- Parameter Initialization. ---
// ---------------------------------
+<<<<<<< HEAD
global cc_count
cc_count = 0;
@@ -53,6 +59,8 @@ cc_count = 0;
global rc_count
rc_count = 0;
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
global SCI2CSTACK
SCI2CSTACK = ['EMPTYSTACK'];
@@ -61,9 +69,12 @@ StackPosition = 1;
global STACKDEDUG
STACKDEDUG = 0; // 1 -> Every Pop and Push operation on the stack, the stack content will be printed on screen.
+<<<<<<< HEAD
global disp_isthere
disp_isthere = 0;
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// -------------------------------------
// --- End parameter Initialization. ---
// -------------------------------------
@@ -142,9 +153,15 @@ while ~meof(fidAST)
//NUT: qui puoi anche aggiunger piu' case per specificare meglio la struttura della funcall
//NUT: i case aggiunti ovviamente faranno solo il push della treeline.
case 'EndOperation' then
+<<<<<<< HEAD
[disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Operation');
case 'EndFuncall' then
[disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Funcall');
+=======
+ [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Operation');
+ case 'EndFuncall' then
+ [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Funcall');
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// --------------
// --- Equal. ---
@@ -154,6 +171,7 @@ while ~meof(fidAST)
//NUT: per fare in modo di coprire le ins, anche se ci puo' essere qualche rischio quando
//NUT: ho miste ins e variabili, per esempio [c(1,1), a] = twooutfun();
//NUT: in questo caso solo una delle due equal va scartata.
+<<<<<<< HEAD
if rc_count > 0 & cc_count == 0
[FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo);
rc_count = 0;
@@ -169,10 +187,15 @@ while ~meof(fidAST)
end
disp_isthere = 0;
+=======
+ [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Equal');
+ SharedInfo = INIT_SharedInfoEqual(SharedInfo);
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
case 'Equal' then
SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block.
AST_PushASTStack(treeline);
case 'Lhs :' then
+<<<<<<< HEAD
if rc_count > 0 & cc_count == 0
SharedInfo.Equal.Lhs = 1;
[EqualInArgName,EqualInArgScope,EqualNInArg] = AST_HandleRC(FileInfo,SharedInfo);
@@ -207,6 +230,21 @@ while ~meof(fidAST)
end
AST_PushASTStack(treeline);
end
+=======
+ SharedInfo.Equal.Lhs = 1; // 1 means that we are inside the Lhs block of the Equal
+ [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_ReadEqualRhsNames(FileInfo,SharedInfo);
+
+ // lengthNumber = length('Number_');
+ // if (part(EqualInArgScope,1:lengthNumber) == 'Number_')
+ // SharedInfo.SkipNextEqual = 1
+ // end
+ SharedInfo.Equal.NInArg = EqualNInArg;
+ for tmpcnt = 1:SharedInfo.Equal.NInArg
+ SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt);
+ SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt);
+ end
+ AST_PushASTStack(treeline);
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// ----------------
// --- If/Else. ---
@@ -240,7 +278,10 @@ while ~meof(fidAST)
// -----------------
case 'EndProgram'
SharedInfo = AST_HandleEndProgram(FileInfo,SharedInfo);
+<<<<<<< HEAD
disp_isthere = 0;
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
//NUT: per essere precisi si puo' pensare di mettere un check
//NUT: alla fine dell'albero per accertarsi che c'e' end program li' dove ce lo aspettiamo
@@ -274,6 +315,7 @@ while ~meof(fidAST)
SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo);
SharedInfo.While.Level = SharedInfo.While.Level - 1;
+<<<<<<< HEAD
case 'Endrc' then
rc_count = rc_count + 1;
@@ -283,6 +325,8 @@ while ~meof(fidAST)
//[FileInfo,SharedInfo] = AST_HandleRC(FileInfo,SharedInfo);
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// ----------------
// --- Default. ---
// ----------------
@@ -290,6 +334,23 @@ while ~meof(fidAST)
AST_PushASTStack(treeline);
end
end
+<<<<<<< HEAD
+=======
+
+// ------------------------------------
+// -----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);
+
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// --------------------------------------
// --- End main loop to read the AST. ---
// --------------------------------------