diff options
Diffstat (limited to 'macros/ASTManagement/AST2Ccode.sci')
-rw-r--r-- | macros/ASTManagement/AST2Ccode.sci | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci index 409eaab1..b1646df3 100644 --- a/macros/ASTManagement/AST2Ccode.sci +++ b/macros/ASTManagement/AST2Ccode.sci @@ -42,12 +42,25 @@ 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; + +global rc_count +rc_count = 0; + +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 global SCI2CSTACK SCI2CSTACK = ['EMPTYSTACK']; @@ -56,6 +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. --- // ------------------------------------- @@ -134,9 +153,16 @@ 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'); + disp(disp_isthere); +======= [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Operation'); case 'EndFuncall' then [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Funcall'); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // -------------- // --- Equal. --- @@ -146,12 +172,67 @@ 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; + elseif cc_count > 0 + [FileInfo,SharedInfo] = AST_HandleFunCC(cc_count,FileInfo,SharedInfo); + rc_count = 0; + cc_count = 0; + else + if disp_isthere == 0 + [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Equal'); + SharedInfo = INIT_SharedInfoEqual(SharedInfo); + end + 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 + disp(disp_isthere); + if rc_count > 0 & cc_count == 0 + SharedInfo.Equal.Lhs = 1; + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_HandleRC(FileInfo,SharedInfo); + SharedInfo.Equal.NInArg = EqualNInArg - rc_count -1; + AST_PushASTStack(treeline); + for tmpcnt = 1:SharedInfo.Equal.NInArg + SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); + SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); + end + elseif cc_count > 0 + SharedInfo.Equal.Lhs = 1; + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_HandleCC(FileInfo,SharedInfo); + AST_PushASTStack(treeline); + else + SharedInfo.Equal.Lhs = 1; // 1 means that we are inside the Lhs block of the Equal + //if SharedInfo.Equal.NOutArg > 0 + if disp_isthere == 0 + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_ReadEqualRhsNames(FileInfo,SharedInfo); + SharedInfo.Equal.NInArg = EqualNInArg; + //end + + // lengthNumber = length('Number_'); + // if (part(EqualInArgScope,1:lengthNumber) == 'Number_') + // SharedInfo.SkipNextEqual = 1 + // end + + for tmpcnt = 1:SharedInfo.Equal.NInArg + SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); + SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); + end + //end + 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); @@ -165,6 +246,7 @@ while ~meof(fidAST) SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); end AST_PushASTStack(treeline); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ---------------- // --- If/Else. --- @@ -198,6 +280,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 @@ -231,6 +317,18 @@ while ~meof(fidAST) SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo); SharedInfo.While.Level = SharedInfo.While.Level - 1; +<<<<<<< HEAD + + case 'Endrc' then + rc_count = rc_count + 1; + + case 'Endcc' then + cc_count = cc_count + 1; + + //[FileInfo,SharedInfo] = AST_HandleRC(FileInfo,SharedInfo); + +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ---------------- // --- Default. --- // ---------------- @@ -238,6 +336,8 @@ while ~meof(fidAST) AST_PushASTStack(treeline); end end +<<<<<<< HEAD +======= // ------------------------------------ // -----List of functions Used-------- @@ -252,6 +352,7 @@ 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. --- // -------------------------------------- |