diff options
author | Brijeshcr | 2017-07-07 18:19:27 +0530 |
---|---|---|
committer | GitHub | 2017-07-07 18:19:27 +0530 |
commit | 8ec9e70b6ffffb927a28941554cf18a822892d72 (patch) | |
tree | 082485f6bd03f8f0044066337699fbcf985f5e5a /macros/ASTManagement/AST2Ccode.sci | |
parent | 2340409c98f9b15bb23944b991e97a1aa4e88ce0 (diff) | |
parent | 17a346fca351d03579d343a9debaa68acdd844d9 (diff) | |
download | Scilab2C_fossee_old-8ec9e70b6ffffb927a28941554cf18a822892d72.tar.gz Scilab2C_fossee_old-8ec9e70b6ffffb927a28941554cf18a822892d72.tar.bz2 Scilab2C_fossee_old-8ec9e70b6ffffb927a28941554cf18a822892d72.zip |
Merge branch 'master' into master
Diffstat (limited to 'macros/ASTManagement/AST2Ccode.sci')
-rw-r--r-- | macros/ASTManagement/AST2Ccode.sci | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci index 5cceaf1..136c5a1 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,16 +43,13 @@ 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; @@ -59,8 +57,6 @@ cc_count = 0; global rc_count rc_count = 0; -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 global SCI2CSTACK SCI2CSTACK = ['EMPTYSTACK']; @@ -69,12 +65,11 @@ 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 + +FName = null // ------------------------------------- // --- End parameter Initialization. --- // ------------------------------------- @@ -153,16 +148,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 + 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'); -======= - [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Operation'); - case 'EndFuncall' then - [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Funcall'); ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 - + end // -------------- // --- Equal. --- // -------------- @@ -171,12 +165,12 @@ 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); + [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 @@ -186,16 +180,13 @@ while ~meof(fidAST) end end disp_isthere = 0; + FName = null -======= - [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); @@ -230,21 +221,6 @@ 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. --- @@ -278,10 +254,8 @@ 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 @@ -315,7 +289,6 @@ while ~meof(fidAST) SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo); SharedInfo.While.Level = SharedInfo.While.Level - 1; -<<<<<<< HEAD case 'Endrc' then rc_count = rc_count + 1; @@ -325,8 +298,6 @@ while ~meof(fidAST) //[FileInfo,SharedInfo] = AST_HandleRC(FileInfo,SharedInfo); -======= ->>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ---------------- // --- Default. --- // ---------------- @@ -334,9 +305,6 @@ while ~meof(fidAST) AST_PushASTStack(treeline); end end -<<<<<<< HEAD -======= - // ------------------------------------ // -----List of functions Used-------- // ------------------------------------- @@ -350,7 +318,6 @@ 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. --- // -------------------------------------- |