diff options
Diffstat (limited to '2.3-1/macros/ASTManagement')
17 files changed, 302 insertions, 0 deletions
diff --git a/2.3-1/macros/ASTManagement/%equal_string.sci b/2.3-1/macros/ASTManagement/%equal_string.sci index 041fb84a..29e8cb6b 100644 --- a/2.3-1/macros/ASTManagement/%equal_string.sci +++ b/2.3-1/macros/ASTManagement/%equal_string.sci @@ -13,4 +13,8 @@ function txt=%equal_string(e) ' '+objectlist2string(e.lhs) 'EndEqual' ] +<<<<<<< HEAD endfunction +======= +endfunction +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 diff --git a/2.3-1/macros/ASTManagement/%funcall_string.sci b/2.3-1/macros/ASTManagement/%funcall_string.sci index 0ee97016..c3101cbe 100644 --- a/2.3-1/macros/ASTManagement/%funcall_string.sci +++ b/2.3-1/macros/ASTManagement/%funcall_string.sci @@ -6,13 +6,17 @@ function txt=%funcall_string(F) // name : string, the name of the function // lhsnb: number, the number of function lhs +<<<<<<< HEAD if F.name <> 'disp' +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 txt=['Funcall : '+F.name ' #lhs : '+string(F.lhsnb) ' Rhs : ' ' '+objectlist2string(F.rhs) 'EndFuncall' ] +<<<<<<< HEAD else txt=['Funcall : '+F.name ' #lhs : '+'0' @@ -21,4 +25,6 @@ txt=['Funcall : '+F.name 'EndFuncall' ] end +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction diff --git a/2.3-1/macros/ASTManagement/%operatio_string.sci b/2.3-1/macros/ASTManagement/%operatio_string.sci index cc18e919..2a3554dc 100644 --- a/2.3-1/macros/ASTManagement/%operatio_string.sci +++ b/2.3-1/macros/ASTManagement/%operatio_string.sci @@ -4,13 +4,17 @@ function txt=%operatio_string(O) //fields: // operands: a list // operator: a string +<<<<<<< HEAD if O.operator <> 'rc' & O.operator <> 'cc' +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 txt=['Operation' ' Operands:' ' '+objectlist2string(O.operands) ' Operator: '+O.operator 'EndOperation' ] +<<<<<<< HEAD elseif O.operator == 'rc' txt=[' Operands:' ' '+objectlist2string(O.operands) @@ -23,3 +27,6 @@ elseif O.operator == 'cc' ] end endfunction +======= +endfunction +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 diff --git a/2.3-1/macros/ASTManagement/%operation_string.sci b/2.3-1/macros/ASTManagement/%operation_string.sci index c9282f67..2de021d9 100644 --- a/2.3-1/macros/ASTManagement/%operation_string.sci +++ b/2.3-1/macros/ASTManagement/%operation_string.sci @@ -10,4 +10,8 @@ function txt=%operation_string(O) ' Operator: '+O.operator 'EndOperation' ] +<<<<<<< HEAD endfunction +======= +endfunction +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 diff --git a/2.3-1/macros/ASTManagement/AST2Ccode.sci b/2.3-1/macros/ASTManagement/AST2Ccode.sci index 563f3133..b1646df3 100644 --- a/2.3-1/macros/ASTManagement/AST2Ccode.sci +++ b/2.3-1/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,10 +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. --- @@ -155,6 +172,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; @@ -170,10 +188,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 disp(disp_isthere); if rc_count > 0 & cc_count == 0 SharedInfo.Equal.Lhs = 1; @@ -209,6 +232,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. --- @@ -242,7 +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 @@ -276,6 +317,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; @@ -285,6 +327,8 @@ while ~meof(fidAST) //[FileInfo,SharedInfo] = AST_HandleRC(FileInfo,SharedInfo); +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ---------------- // --- Default. --- // ---------------- @@ -292,6 +336,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. --- // -------------------------------------- diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index 96830aa9..6c2abed3 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -1,5 +1,9 @@ +<<<<<<< HEAD function [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,ASTFunType) +======= +function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType) +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType) // ----------------------------------------------------------------- // #RNU_RES_B @@ -36,7 +40,11 @@ function [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,F // ------------------------------ // --- Check input arguments. --- // ------------------------------ +<<<<<<< HEAD SCI2CNInArgCheck(argn(2),4,4); +======= +SCI2CNInArgCheck(argn(2),3,3); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ----------------------- // --- Initialization. --- @@ -61,8 +69,11 @@ PrintStepInfo('Handling Funcall/Operation/Equal',FileInfo.Funct(nxtscifunnumber) global SCI2CSTACK global StackPosition; global STACKDEDUG +<<<<<<< HEAD disp_isthere = 0; +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // --------------------------- // --- End Initialization. --- // --------------------------- @@ -74,6 +85,7 @@ disp_isthere = 0; //NUT: verifica se ASTFunType e' veramente importante // #RNU_RES_E [ASTFunName,InArg,NInArg,OutArg,NOutArg] = AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType); +<<<<<<< HEAD NOutArg_mod = NOutArg if ASTFunName == 'OpLogAnd' AST_PushASTStack('&&'); @@ -88,6 +100,13 @@ NOutArg_mod = NOutArg disp_isthere = 1; end +======= +if (ASTFunType=='Funcall') +SharedInfo.Function_list(SharedInfo.Function_list_index) = ASTFunName; +SharedInfo.Function_list_index = SharedInfo.Function_list_index + 1; +end +NOutArg_mod = NOutArg +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(mtlb_strcmp(part(ASTFunName,1:2),'CV') == %T) SharedInfo.OpenCVUsed = %T; end @@ -127,8 +146,11 @@ NOutArg_mod = NOutArg PrintStringInfo(' ',ReportFileName,'both','y'); error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.'); end +<<<<<<< HEAD elseif(ASTFunName == 'raspi' | ASTFunName == 'raspi_close') SharedInfo.SkipNextFun = 1; +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 end // #RNU_RES_B @@ -136,6 +158,7 @@ NOutArg_mod = NOutArg // --- Read the function annotations. --- // -------------------------------------- // #RNU_RES_E +<<<<<<< HEAD if ASTFunName == '%k' ASTFunName='modk'; end @@ -143,6 +166,8 @@ NOutArg_mod = NOutArg if ASTFunName == '%sn' ASTFunName='modsn'; end +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if (ASTFunName == 'OpEqual') FunTypeAnnot = ''; @@ -156,7 +181,10 @@ NOutArg_mod = NOutArg // --- Search for Equal Lhs and precision specifier to be applied to the current function. --- // ------------------------------------------------------------------------------------------- // #RNU_RES_E +<<<<<<< HEAD PrintStringInfo(' no of out arguments' + string(NOutArg),ReportFileName,'file','y'); +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 [LhsArg,NLhsArg,FunPrecSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,ASTFunName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo); //NUT: questa funzione contiene troppi parametri e mi sembra disordinata. @@ -354,6 +382,7 @@ NOutArg_mod = NOutArg OutArg(1).Name = string(OutArg(1).Value); elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) OutArg(1).Name = string(OutArg(1).Value); +<<<<<<< HEAD //elseif ASTFunName == 'disp' else [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo); @@ -361,6 +390,10 @@ NOutArg_mod = NOutArg PrintStringInfo(' returning back due logical function',ReportFileName,'file','y'); return; end +======= + else + [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 end if ((ASTFunName == 'uint8') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) @@ -404,8 +437,11 @@ NOutArg_mod = NOutArg // Scope already set above. elseif (ASTFunName == 'double' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) // Scope already set above. +<<<<<<< HEAD //elseif ASTFunName == 'disp' //do nothing +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 else OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo); end @@ -424,8 +460,11 @@ NOutArg_mod = NOutArg //#RNUREM_ME A number is not inserted in the symbol table. elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) //#RNUREM_ME A number is not inserted in the symbol table. +<<<<<<< HEAD //elseif ASTFunName == 'disp' //do nothing +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 else ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); end @@ -458,6 +497,7 @@ NOutArg_mod = NOutArg // -------------------------------------------- //#RNU_RES_E //disp(OutArg,InArg,ASTFunName) +<<<<<<< HEAD CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg_mod); @@ -465,6 +505,14 @@ NOutArg_mod = NOutArg //#RNU_RES_B PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y'); if(IsArduinoFunction(ASTFunName)) +======= + CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg_mod); + + //#RNU_RES_B + PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y'); + if(IsArduinoFunction(ASTFunName)) + //disp(ASTFunName) +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if(IsArduinoSetupFunction(ASTFunName)) //If current function is an arduino setup function (like 'dc_motor_setup'), it //should not be converted and inserted here. It is inserted in a list now and @@ -485,8 +533,12 @@ NOutArg_mod = NOutArg else LibTypeInfo = 'USER2C'; end +<<<<<<< HEAD +======= + +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //#RNU_RES_B // ------------------------------------------------------------------------------------ // --- Check whether the function has been already called in the current .sci file. --- @@ -533,8 +585,11 @@ NOutArg_mod = NOutArg SharedInfo.SkipNextFun > 0 | ... ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & (SharedInfo.SkipNextPrec == 1))) // Do nothing +<<<<<<< HEAD //elseif ASTFunName == 'disp' // Do nothing +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 else AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName); end diff --git a/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci b/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci index 2b549ed6..449586f7 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci @@ -74,13 +74,20 @@ global STACKDEDUG // --------------------------------------------------- //#RNU_RES_E if (ASTIfExpType~='else') +<<<<<<< HEAD [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType); +======= + [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 else // "else" type doesn't contain any condition to test. IfCondArg = ''; NIfCondArg = 0; +<<<<<<< HEAD Op = ''; NOp = 0; +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 end //#RNU_RES_B @@ -89,6 +96,10 @@ end // ----------------------------- // --- Generate the C code for if/elseif Expression. --- //#RNU_RES_E +<<<<<<< HEAD SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,FileInfo,SharedInfo); +======= +SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction diff --git a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci b/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci index d8c2f73c..9b5dce15 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci @@ -36,8 +36,11 @@ global SCI2CSTACK global StackPosition; global STACKDEDUG +<<<<<<< HEAD IfCondArg = []; NIfCondArg = 0; +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ------------------------------ // --- Check input arguments. --- @@ -72,6 +75,7 @@ PrintStringInfo(' Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPa // --- Generate C code. --- // ------------------------ //#RNU_RES_E +<<<<<<< HEAD flagendpop = 0; IfExprField = AST_PopASTStack(); @@ -106,6 +110,38 @@ end IfCondArg = SCI2Cflipud(IfCondArg); SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo); +======= +if(SharedInfo.WhileExpr.CondVar == '') + //#RNU_RES_B + // It means that we are handling something like while(a) or while(1) + // The while condition variable is generated by the HandleEndGenFun. + //#RNU_RES_E + + // --- Pop the name of the condition variable or number. --- + Pop1 = AST_PopASTStack(); + + [ArgName,ArgScope] = AST_ExtractNameAndScope(Pop1); + if (length(ArgName) == 0) + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Expected while(variable) or while(number).','','stdout','y'); + PrintStringInfo('SCI2CERROR: Expected a variable or number in the AST while expression.','','stdout','y'); + PrintStringInfo('SCI2CERROR: Report this error to http://forge.scilab.org/index.php/p/scilab2c/issues/.','','stdout','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + error(9999, 'Expected a conditional variable in the while expression'); + end + + SharedInfo.WhileExpr.CondVar = ArgName; + //#RNU_RES_B + // --- Repush strings into the AST stack. --- + //#RNU_RES_E + + AST_PushASTStack(Pop1); + +elseif (SharedInfo.WhileExpr.DimCondVar > 0) + error(9999, 'Cannot manage while with matrix conditions'); +end +SharedInfo = C_WhileExpression(FileInfo,SharedInfo); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // -------------------------- // --- Update SharedInfo. --- diff --git a/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci index 68bc3da7..528ddaee 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci @@ -123,7 +123,11 @@ end // ------------------------ //#RNU_RES_B PrintStringInfo('Function Name: '+FunctionName,ReportFileName,'file','y','n'); +<<<<<<< HEAD PrintStringInfo('N Input Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +======= +PrintStringInfo('N Intput Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //#RNU_RES_E if (SharedInfo.Equal.Nins > 0) //#RNU_RES_B diff --git a/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci index 3c322dd5..ac9c4004 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci @@ -87,10 +87,13 @@ NOutArg = eval(stripblanks(part(buffstring,10:length(buffstring)))); buffstring = AST_PopASTStack(); FunctionName = stripblanks(part(buffstring,12:length(buffstring))); +<<<<<<< HEAD //if (FunctionName == 'disp') // NOutArg = 0; //end +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ------------------------------------- // --- Generate the InArg structure. --- // ------------------------------------- diff --git a/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci index 2bfb08dd..81d7e80b 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci @@ -1,4 +1,8 @@ +<<<<<<< HEAD function [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) +======= +function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) // ----------------------------------------------------------------- //#RNU_RES_B @@ -63,6 +67,7 @@ global STACKDEDUG // ------------------------------------ // --- Read if condition variables. --- // ------------------------------------ +<<<<<<< HEAD //OutArgOld=[]; //OutArgNew=[]; @@ -77,12 +82,19 @@ global STACKDEDUG flagendpop = 0; IfExprField = AST_PopASTStack(); PrintStringInfo(' '+IfExprField+' '+ASTIfExpType,ReportFileName,'file','y'); +======= +flagendpop = 0; +IfExprField = AST_PopASTStack(); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 if (ASTIfExpType=='if') if (IfExprField=='Expression:') flagendpop = 1; // Pop Again the If tag from the AST. IfExprField = AST_PopASTStack(); +<<<<<<< HEAD PrintStringInfo(' '+IfExprField,ReportFileName,'file','y'); +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 end elseif (ASTIfExpType=='elseif') if (IfExprField=='Else If Expression') @@ -91,13 +103,18 @@ elseif (ASTIfExpType=='elseif') else error(9999, 'Unknown ASTIfExpType ""'+ASTIfExpType+'"".'); end +<<<<<<< HEAD NOp=0; Op=[]; +======= + +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 while (flagendpop == 0) if (IfExprField~='<EOL>') if (ASTIfExpType=='if') if (IfExprField=='Expression:') flagendpop = 1; +<<<<<<< HEAD //PrintStringInfo('hello dere '+IfExprField,ReportFileName,'file','y'); // Pop Again the If tag from the AST. IfExprField = AST_PopASTStack(); @@ -114,10 +131,18 @@ while (flagendpop == 0) IfCondArg(NIfCondArg) = IfExprField; end //[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); +======= + // Pop Again the If tag from the AST. + IfExprField = AST_PopASTStack(); + else + NIfCondArg = NIfCondArg + 1; + [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 end elseif (ASTIfExpType=='elseif') if (IfExprField=='Else If Expression') flagendpop = 1; +<<<<<<< HEAD //IfExprField = AST_PopASTStack(); else if (IfExprField=='&&' | IfExprField=='||') @@ -142,6 +167,18 @@ end IfCondArg = SCI2Cflipud(IfCondArg); +======= + else + NIfCondArg = NIfCondArg + 1; + IfCondArg(NIfCondArg) = IfExprField; + [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + end + end + end + IfExprField = AST_PopASTStack(); +end + +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 //#RNU_RES_B // ------------------------------------------- // --- Print some info in the report file. --- diff --git a/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci index 903f0958..2bd45fbb 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci @@ -61,6 +61,7 @@ LabelFunctName = 'Operator: '; FunctionName = stripblanks(part(buffstring,length(LabelFunctName)+1:length(buffstring))); // Generate the proper function name. FunctionName = Operator2FunName(FunctionName); +<<<<<<< HEAD PrintStringInfo(' '+FunctionName,ReportFileName,'file','y'); if (FunctionName == 'OpLogAnd' | FunctionName=='OpLogOr') @@ -72,6 +73,8 @@ if (FunctionName == 'OpLogAnd' | FunctionName=='OpLogOr') //RhsField = AST_PopASTStack(); return ; end +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // ------------------------------ // --- Read input parameters. --- diff --git a/2.3-1/macros/ASTManagement/GenOutArgNames.sci b/2.3-1/macros/ASTManagement/GenOutArgNames.sci index 7b62c794..800b8d6d 100644 --- a/2.3-1/macros/ASTManagement/GenOutArgNames.sci +++ b/2.3-1/macros/ASTManagement/GenOutArgNames.sci @@ -32,12 +32,15 @@ SCI2CNInArgCheck(argn(2),9,9); nxtscifunname = SharedInfo.NextSCIFunName; nxtscifunnumber = SharedInfo.NextSCIFunNumber; ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +<<<<<<< HEAD global SCI2CSTACK global StackPosition; global STACKDEDUG +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 // #RNU_RES_B PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); // #RNU_RES_E @@ -49,6 +52,7 @@ OutArg = OldOutArg; // --------------------------------------------------------------------------------------- // At this step only the name of the output arguments can be generated. --- //#RNU_RES_E +<<<<<<< HEAD if (FunctionName ~= 'OpLogGt' & FunctionName ~= 'OpLogLt' & FunctionName ~= 'OpLogGe' & FunctionName ~= 'OpLogLe' & FunctionName ~= 'OpLogNe' & FunctionName ~= 'OpLogEq') if (NLhsArg > 0) //#RNU_RES_B @@ -114,4 +118,49 @@ else s = AST_PopASTStack(); PrintStringInfo(' Pushing in the AST stack: ""'+s+'"".',ReportFileName,'file','y'); end +======= +if (NLhsArg > 0) + //#RNU_RES_B + // Use the equal Lhs names. + PrintStringInfo('Using Equal Lhs names.',ReportFileName,'file','y'); + //#RNU_RES_E + if (NLhsArg ~= NOutArg) + error(9999, 'NLhsArg='+string(NLhsArg)+' must be equal to NOutArg='+string(NOutArg)+'.'); + end + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name=LhsArg(counteroutputargs).Name; + OutArg(counteroutputargs).Scope=LhsArg(counteroutputargs).Scope; + end +else + //#RNU_RES_B + // Generate temporary variables. + PrintStringInfo('Generating temporary variables.',ReportFileName,'file','y'); + //#RNU_RES_E + if ((sum(mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec)) > 0) & ... + (SharedInfo.SkipNextPrec == 1)) + //#RNU_RES_B + PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); + //#RNU_RES_E + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name = InArg(counteroutputargs).Name; + end + elseif (mtlb_strcmp(FunctionName,'OpEqual')) + // do nothing. + //NUT: verifica questa parte di codice. e' sicuro che se ho equal gli oldoutarg contengono gia' il nome? + else + for counteroutputargs = 1:NOutArg + if ((SharedInfo.ASTReader.EnableTempVarsReuse == 1) & ... + (length(SharedInfo.ASTReader.ReusableTempVars) > 0)) + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.ReusableTempVars(1))]); + SharedInfo.ASTReader.ReusableTempVars = SharedInfo.ASTReader.ReusableTempVars(2:$); + else + SharedInfo.ASTReader.UsedTempVars = SharedInfo.ASTReader.UsedTempVars + 1; + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.UsedTempVars)]); + end + OutArg(counteroutputargs).Name=TmpOutArgName; + end + end +end + +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction diff --git a/2.3-1/macros/ASTManagement/_funcall_string.sci b/2.3-1/macros/ASTManagement/_funcall_string.sci index 0ee97016..c3101cbe 100644 --- a/2.3-1/macros/ASTManagement/_funcall_string.sci +++ b/2.3-1/macros/ASTManagement/_funcall_string.sci @@ -6,13 +6,17 @@ function txt=%funcall_string(F) // name : string, the name of the function // lhsnb: number, the number of function lhs +<<<<<<< HEAD if F.name <> 'disp' +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 txt=['Funcall : '+F.name ' #lhs : '+string(F.lhsnb) ' Rhs : ' ' '+objectlist2string(F.rhs) 'EndFuncall' ] +<<<<<<< HEAD else txt=['Funcall : '+F.name ' #lhs : '+'0' @@ -21,4 +25,6 @@ txt=['Funcall : '+F.name 'EndFuncall' ] end +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 endfunction diff --git a/2.3-1/macros/ASTManagement/_operatio_string.sci b/2.3-1/macros/ASTManagement/_operatio_string.sci index e9332337..76753868 100644 --- a/2.3-1/macros/ASTManagement/_operatio_string.sci +++ b/2.3-1/macros/ASTManagement/_operatio_string.sci @@ -10,4 +10,8 @@ function txt=%operatio_string(O) ' Operator: '+O.operator 'EndOperation' ] +<<<<<<< HEAD endfunction +======= +endfunction +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 diff --git a/2.3-1/macros/ASTManagement/_operation_string.sci b/2.3-1/macros/ASTManagement/_operation_string.sci index c9282f67..2de021d9 100644 --- a/2.3-1/macros/ASTManagement/_operation_string.sci +++ b/2.3-1/macros/ASTManagement/_operation_string.sci @@ -10,4 +10,8 @@ function txt=%operation_string(O) ' Operator: '+O.operator 'EndOperation' ] +<<<<<<< HEAD endfunction +======= +endfunction +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 diff --git a/2.3-1/macros/ASTManagement/names b/2.3-1/macros/ASTManagement/names index 6deb883d..62b7d189 100644 --- a/2.3-1/macros/ASTManagement/names +++ b/2.3-1/macros/ASTManagement/names @@ -21,7 +21,10 @@ AST_ExtractNameAndScope AST_GetASTFile AST_GetFuncallPrm AST_GetPrecAndLhsArg +<<<<<<< HEAD AST_HandleCC +======= +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 AST_HandleEOL AST_HandleEndFor AST_HandleEndGenFun @@ -29,11 +32,16 @@ AST_HandleEndProgram AST_HandleEndWhile AST_HandleFor AST_HandleForStatem +<<<<<<< HEAD AST_HandleFunCC AST_HandleFunRC AST_HandleHeader AST_HandleIfElse AST_HandleRC +======= +AST_HandleHeader +AST_HandleIfElse +>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 AST_HandleWhileExpr AST_HandleWhileStatem AST_ParseEqualStruct |