From 421c1e8f67b6f1b4b5235fe27941c40ab423b1d9 Mon Sep 17 00:00:00 2001 From: Henning Kiel Date: Sat, 23 Nov 2013 13:45:16 +0000 Subject: [PATCH] replaced O(n) listLength(L)==0 by O(1) List.isEmpty(L) git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18258 f25d12d1-65f4-0310-ae8a-bbce733d8d8e --- Compiler/BackEnd/BackendDAECreate.mo | 16 +++++++------- Compiler/BackEnd/BackendDAEOptimize.mo | 2 +- Compiler/BackEnd/BackendDAEUtil.mo | 2 +- Compiler/BackEnd/HpcOmScheduler.mo | 4 ++-- Compiler/BackEnd/HpcOmTaskGraph.mo | 18 ++++++++-------- Compiler/BackEnd/Initialization.mo | 2 +- Compiler/BackEnd/OnRelaxation.mo | 14 ++++++------ Compiler/BackEnd/OpenTURNS.mo | 2 +- Compiler/BackEnd/Tearing.mo | 30 +++++++++++++------------- Compiler/BackEnd/Uncertainties.mo | 16 +++++++------- Compiler/FrontEnd/InnerOuter.mo | 2 +- Compiler/FrontEnd/Inst.mo | 2 +- Compiler/FrontEnd/InstUtil.mo | 4 ++-- Compiler/FrontEnd/InstVar.mo | 2 +- Compiler/FrontEnd/Mod.mo | 4 ++-- Makefile.common | 2 +- 16 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Compiler/BackEnd/BackendDAECreate.mo b/Compiler/BackEnd/BackendDAECreate.mo index 14ea769305e..997a6863f4d 100644 --- a/Compiler/BackEnd/BackendDAECreate.mo +++ b/Compiler/BackEnd/BackendDAECreate.mo @@ -1784,7 +1784,7 @@ algorithm equation (DAE.PARTIAL_EQUATION(cond), source) = Inline.simplifyAndInlineEquationExp(DAE.PARTIAL_EQUATION(cond), (SOME(functionTree), {DAE.NORM_INLINE()}), source); (res, reinit) = lowerWhenEqn2(listReverse(eqnl), cond, functionTree, inEquationLst, {}); - whenClauseList = makeWhenClauses(listLength(reinit) > 0, cond, reinit, inWhenClauseLst); + whenClauseList = makeWhenClauses(List.isNotEmpty(reinit), cond, reinit, inWhenClauseLst); then (res, whenClauseList); @@ -1793,7 +1793,7 @@ algorithm (elseEqnLst, whenClauseList) = lowerWhenEqn(elsePart, functionTree, {}, inWhenClauseLst); (DAE.PARTIAL_EQUATION(cond), source) = Inline.simplifyAndInlineEquationExp(DAE.PARTIAL_EQUATION(cond), (SOME(functionTree), {DAE.NORM_INLINE()}), source); (trueEqnLst, reinit) = lowerWhenEqn2(listReverse(eqnl), cond, functionTree, {}, {}); - whenClauseList = makeWhenClauses(listLength(reinit) > 0, cond, reinit, whenClauseList); + whenClauseList = makeWhenClauses(List.isNotEmpty(reinit), cond, reinit, whenClauseList); res = mergeClauses(trueEqnLst, elseEqnLst, inEquationLst); then (res, whenClauseList); @@ -3752,7 +3752,7 @@ algorithm e_1 = DAE.LUNARY(op, e1); {zc} = makeZeroCrossings({e_1}, {eq_count}, {wc_count}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); Debug.fcall(Flags.RELIDX, BackendDump.debugExpStr, (e_1, "\n")); then ((e, false, ((zeroCrossings, relations, samples, numRelations, numMathFunctions), (eq_count, wc_count, vars, knvars)))); @@ -3766,7 +3766,7 @@ algorithm e_1 = DAE.LBINARY(e_1, op, e_2); {zc} = makeZeroCrossings({e_1}, {eq_count}, {wc_count}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); print(Debug.fcallret1(Flags.RELIDX, BackendDump.zeroCrossingListString, zeroCrossings, "")); then ((e_1, false, ((zeroCrossings, relations, samples, numRelations1, numMathFunctions), (eq_count, wc_count, vars, knvars)))); @@ -3920,7 +3920,7 @@ algorithm e_1 = DAE.LUNARY(op, e1); {zc} = makeZeroCrossings({e_1}, {alg_indx}, {}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); Debug.fcall(Flags.RELIDX, BackendDump.debugExpStr, (e_1, "\n")); then ((e, false, (iterator, le, range, (zeroCrossings, relations, samples, numRelations, numMathFunctions), (alg_indx, vars, knvars)))); @@ -3934,7 +3934,7 @@ algorithm e_1 = DAE.LBINARY(e_1, op, e_2); {zc} = makeZeroCrossings({e_1}, {alg_indx}, {}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); print(Debug.fcallret1(Flags.RELIDX, BackendDump.zeroCrossingListString, zeroCrossings, "")); then ((e_1, false, (iterator, le, range, (zeroCrossings, relations, samples, numRelations1, numMathFunctions), (alg_indx, vars, knvars)))); @@ -4104,7 +4104,7 @@ algorithm e_1 = DAE.LUNARY(op, e1); {zc} = makeZeroCrossings({e_1}, {alg_indx}, {}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); Debug.fcall(Flags.RELIDX, BackendDump.debugExpStr, (e_1, "\n")); then ((e_1, false, (iterator, inExpLst, range, (zeroCrossings, relations, samples, numRelations, numMathFunctions), (alg_indx, vars, knvars)))); @@ -4138,7 +4138,7 @@ algorithm e_1 = DAE.LBINARY(e_1, op, e_2); {zc} = makeZeroCrossings({e_1}, {alg_indx}, {}); zc_lst = List.select1(zeroCrossings, sameZeroCrossing, zc); - zeroCrossings = Util.if_(listLength(zc_lst)==0, listAppend(zeroCrossings, {zc}), zeroCrossings); + zeroCrossings = Util.if_(List.isEmpty(zc_lst), listAppend(zeroCrossings, {zc}), zeroCrossings); print(Debug.fcallret1(Flags.RELIDX, BackendDump.zeroCrossingListString, zeroCrossings, "")); then ((e_1, false, (iterator, inExpLst, range, (zeroCrossings, relations, samples, numRelations1, numMathFunctions), (alg_indx, vars, knvars)))); diff --git a/Compiler/BackEnd/BackendDAEOptimize.mo b/Compiler/BackEnd/BackendDAEOptimize.mo index fea19d6f957..c8d2bdf6194 100644 --- a/Compiler/BackEnd/BackendDAEOptimize.mo +++ b/Compiler/BackEnd/BackendDAEOptimize.mo @@ -1163,7 +1163,7 @@ algorithm (syst,m,mT) = BackendDAEUtil.getIncidenceMatrixfromOption(syst,BackendDAE.NORMAL(),SOME(funcs)); // check equations (m_1,(mT_1,_,eqns1,changed)) = traverseIncidenceMatrix(m,removeEqualFunctionCallFinder,(mT,vars,eqns,{})); - b = intGt(listLength(changed),0); + b = List.isNotEmpty(changed); // update arrayeqns and algorithms, collect info for wrappers syst = BackendDAE.EQSYSTEM(vars,eqns,SOME(m_1),SOME(mT_1),BackendDAE.NO_MATCHING(),stateSets); syst = BackendDAEUtil.updateIncidenceMatrix(syst,BackendDAE.NORMAL(),NONE(),changed); diff --git a/Compiler/BackEnd/BackendDAEUtil.mo b/Compiler/BackEnd/BackendDAEUtil.mo index 445c7e1b31b..ced83cfacb7 100644 --- a/Compiler/BackEnd/BackendDAEUtil.mo +++ b/Compiler/BackEnd/BackendDAEUtil.mo @@ -274,7 +274,7 @@ algorithm case ((exp,(vars,lstExpCrefs))) equation ((_,(_,crefs))) = Expression.traverseExp(exp,traversecheckBackendDAEExp,(vars,{})); - lstExpCrefs1 = Util.if_(listLength(crefs)>0,(exp,crefs)::lstExpCrefs,lstExpCrefs); + lstExpCrefs1 = Util.if_(List.isNotEmpty(crefs),(exp,crefs)::lstExpCrefs,lstExpCrefs); then ((exp,(vars,lstExpCrefs1))); case _ then inTpl; diff --git a/Compiler/BackEnd/HpcOmScheduler.mo b/Compiler/BackEnd/HpcOmScheduler.mo index ebf2f84cb92..a275889f59d 100644 --- a/Compiler/BackEnd/HpcOmScheduler.mo +++ b/Compiler/BackEnd/HpcOmScheduler.mo @@ -178,7 +178,7 @@ algorithm //get all predecessors (childs) (predecessors, _) = getSuccessorsByTask(head, iTaskGraphT, iAllTasks); (successors, successorIdc) = getSuccessorsByTask(head, iTaskGraph, iAllTasks); - true = intGt(listLength(predecessors), 0); //in this case the node has predecessors + true = List.isNotEmpty(predecessors); //in this case the node has predecessors //print("Handle task " +& intString(index) +& " with " +& intString(listLength(predecessors)) +& " child nodes and " +& intString(listLength(successorIdc)) +& " parent nodes.\n"); //get last child finished time @@ -1327,7 +1327,7 @@ algorithm //get all predecessors (childs) (predecessors, _) = getSuccessorsByTask(head, iTaskGraphT, iAllTasks); (successors, successorIdc) = getSuccessorsByTask(head, iTaskGraph, iAllTasks); - true = intGt(listLength(predecessors), 0); //in this case the node has predecessors + true = List.isNotEmpty(predecessors); //in this case the node has predecessors //print("Handle task " +& intString(index) +& " with " +& intString(listLength(predecessors)) +& " child nodes and " +& intString(listLength(successorIdc)) +& " parent nodes.\n"); //find thread for scheduling diff --git a/Compiler/BackEnd/HpcOmTaskGraph.mo b/Compiler/BackEnd/HpcOmTaskGraph.mo index 5f2b01c513a..c00ab158625 100644 --- a/Compiler/BackEnd/HpcOmTaskGraph.mo +++ b/Compiler/BackEnd/HpcOmTaskGraph.mo @@ -479,7 +479,7 @@ algorithm (adjLst,rootNodes); case(_,_,_,_,_) equation - true = listLength(parentLst) == 0; + true = List.isEmpty(parentLst); rootNodes = childNode::rootNodesIn; then (adjLstIn,rootNodes); @@ -1689,7 +1689,7 @@ algorithm BackendDAE.EQSYSTEM(orderedVars=orderedVars) = systIn; varLst = BackendVariable.varList(orderedVars); stateVars = getStates(varLst,{},1); - true = listLength(stateVars) >= 1; + true = List.isNotEmpty(stateVars); stateVars = List.map1(stateVars,intAdd,varOffset); stateNodes = matchWithAssignments(stateVars,varSccMapping); stateNodes = List.map3(stateNodes,getCompInComps,1,inComps,arrayCreate(arrayLength(inComps),0)); @@ -1702,7 +1702,7 @@ algorithm BackendDAE.EQSYSTEM(orderedVars=orderedVars) = systIn; varLst = BackendVariable.varList(orderedVars); stateVars = getStates(varLst,{},1); - true = listLength(stateVars) == 0; + true = List.isEmpty(stateVars); varOffsetNew = listLength(varLst)+varOffset; then ((stateNodesIn,varOffsetNew)); @@ -3127,7 +3127,7 @@ algorithm oneChildren := List.removeOnTrue(1,compareListLengthOnTrue,oneChildren); // remove paths of length 1 //oneChildren := List.fold1(List.intRange(listLength(oneChildren)),checkParentNode,graphIn,oneChildren); // deletes the lists with just one entry that have more than one parent (graphOut,graphDataOut) := contractNodesInGraph(oneChildren,graphIn,graphDataIn); - oChanged := intGt(listLength(oneChildren), 0); + oChanged := List.isNotEmpty(oneChildren); end mergeSimpleNodes; @@ -3145,7 +3145,7 @@ algorithm iGraphT := transposeTaskGraph(iGraph); mergedNodes := mergeParentNodes0(iGraph, iGraphT, iGraphData, 1, {}); (oGraph,oGraphData) := contractNodesInGraph(mergedNodes, iGraph, iGraphData); - oChanged := intGt(listLength(mergedNodes),0); + oChanged := List.isNotEmpty(mergedNodes); end mergeParentNodes; protected function mergeParentNodes0 @@ -4744,7 +4744,7 @@ algorithm case(_,_,TASKGRAPHMETA(inComps=inComps,exeCosts=exeCosts),_,_) equation //critical path of node is currently unknown -> calculate it childNodes = arrayGet(iGraph, iNode); - true = intGt(listLength(childNodes),0); //has children + true = List.isNotEmpty(childNodes); //has children criticalPaths = List.map4(childNodes, getCriticalPath1, iGraph, iGraphData, iHandleCommCosts, iNodeCriticalPaths); criticalPathIdx = getCriticalPath2(criticalPaths, 1, -1.0, -1); ((cpCalcTime, criticalPathChild)) = listGet(criticalPaths, criticalPathIdx); @@ -4760,7 +4760,7 @@ algorithm case(_,_,TASKGRAPHMETA(inComps=inComps,exeCosts=exeCosts),_,_) equation //critical path of node is currently unknown -> calculate it childNodes = arrayGet(iGraph, iNode); - false = intGt(listLength(childNodes),0); //has no children + false = List.isNotEmpty(childNodes); //has no children criticalPath = iNode :: {}; nodeComps = arrayGet(inComps, iNode); calcTime = addUpExeCostsForNode(nodeComps, exeCosts, 0.0); //sum up calc times of all components @@ -5530,7 +5530,7 @@ algorithm equation commCosts = arrayGet(iCommCosts, iParentComp); filteredCommCosts = List.filter1OnTrue(commCosts, getCommCostBetweenNodes1, iChildComps); - true = intGt(listLength(filteredCommCosts), 0); + true = List.isNotEmpty(filteredCommCosts); highestCommCost = getHighestCommCost(filteredCommCosts, (-1,-1,-1)); then SOME(highestCommCost); else then NONE(); @@ -5724,7 +5724,7 @@ end sumUpExecCosts1; // //print("for "+&intString(childNodeIn)+&" the parents "+&stringDelimitList(List.map(parents,intString),",")+&"\n"); // //print("collected Nodes "+&stringDelimitList(List.map(collectedNodes,intString),",")+&"\n"); // (_,parents,_) = List.intersection1OnTrue(parents,childNodeIn::collectedNodes,intEq); -// true = listLength(parents) == 0; +// true = List.isEmpty(parents); // then // childNodeIn; // else diff --git a/Compiler/BackEnd/Initialization.mo b/Compiler/BackEnd/Initialization.mo index 16ebf6f4b2b..8b8dd87b018 100644 --- a/Compiler/BackEnd/Initialization.mo +++ b/Compiler/BackEnd/Initialization.mo @@ -190,7 +190,7 @@ algorithm Debug.fcall2(Flags.DUMP_INITIAL_SYSTEM, BackendDump.dumpBackendDAE, initdae, "solved initial system"); // warn about selected default initial conditions - b = intGt(listLength(dumpVars), 0); + b = List.isNotEmpty(dumpVars); Debug.bcall(b and (not Flags.isSet(Flags.INITIALIZATION)), Error.addCompilerWarning, "The initial conditions are not fully specified. Use +d=initialization for more information."); Debug.bcall(b and Flags.isSet(Flags.INITIALIZATION), Error.addCompilerWarning, "Assuming fixed start value for the following " +& intString(listLength(dumpVars)) +& " variables:\n" +& warnAboutVars2(dumpVars)); diff --git a/Compiler/BackEnd/OnRelaxation.mo b/Compiler/BackEnd/OnRelaxation.mo index d6f1470487b..bd3dd4f699d 100644 --- a/Compiler/BackEnd/OnRelaxation.mo +++ b/Compiler/BackEnd/OnRelaxation.mo @@ -654,7 +654,7 @@ algorithm // remove assigned equation of this row next = List.removeOnTrue(ass1[r], intEq, next); // print("Eqns use Var " +& intString(r) +& " : " +& stringDelimitList(List.map(next,intString),", ") +& "\n"); - true = intGt(listLength(next),0); + true = List.isNotEmpty(next); then generateCliquesResidual1(rest,ass1,ass2,m,mt,mark,rowmarks,colummarks,ifoundFlow,vars); case (r::rest,_,_,_,_,_,_,_,_,_) @@ -666,7 +666,7 @@ algorithm next = List.select2(next, unmarked, colummarks, mark); // remove assigned equation of this row next = List.removeOnTrue(ass1[r], intEq, next); - false = intGt(listLength(next),0); + false = List.isNotEmpty(next); _ = arrayUpdate(rowmarks,r,mark); e = ass1[r]; // print("Go From " +& intString(r) +& " to " +& intString(e) +& "\n"); @@ -883,7 +883,7 @@ algorithm // remove assigned next = List.fold1(ass2[e],List.removeOnTrue, intEq, next); // print("Used Vars of " +& intString(e) +& " : " +& stringDelimitList(List.map(next,intString),", ") +& "\n"); - true = intGt(listLength(next),0); + true = List.isNotEmpty(next); then prepairOrphansOrder1(rest,ass1,ass2,m,mt,mark,rowmarks,colummarks,preorphan,orphans,prer,ifoundFlow,vars); case (e::rest,_,_,_,_,_,_,_,_,_,_,_,_) @@ -895,7 +895,7 @@ algorithm next = List.select2(next, unmarked, rowmarks, mark); // remove assigned next = List.fold1(ass2[e],List.removeOnTrue, intEq, next); - false = intGt(listLength(next),0); + false = List.isNotEmpty(next); _ = arrayUpdate(colummarks,e,mark); r = ass2[e]; // print("Go From " +& intString(e) +& " to " +& stringDelimitList(List.map(r,intString),", ") +& "\n"); @@ -2905,7 +2905,7 @@ algorithm // print("Process Colum " +& intString(c) +& " Rows " +& stringDelimitList(List.map(r,intString),", ") +& " " +& boolString(b) +&"\n"); (colums1,b2) = getIndexQueque1(r,c,mT,mark,rowmarks,{},false); // BackendDump.debuglst((colums1,intString,", ","\n")); - b1 = intGt(listLength(colums),0); + b1 = List.isNotEmpty(colums); // cons next rows in front to jump over marked nodes queue = Debug.bcallret3(b1, List.unionOnTrue, colums1, nextqueue, intEq, nextqueue); // print("queue: "); BackendDump.debuglst((queue,intString,", ","\n")); @@ -3002,7 +3002,7 @@ protected function isResOrphan input array> ass; output Boolean b; algorithm - b := intLt(listLength(ass[indx]),1); + b := List.isEmpty(ass[indx]); end isResOrphan; protected function isNoResOrphan @@ -3010,7 +3010,7 @@ protected function isNoResOrphan input array> ass; output Boolean b; algorithm - b := intGt(listLength(ass[indx]),0); + b := List.isNotEmpty(ass[indx]); end isNoResOrphan; protected function doAssign "author: Frenkel TUD 2012-05" diff --git a/Compiler/BackEnd/OpenTURNS.mo b/Compiler/BackEnd/OpenTURNS.mo index 708b2dec16a..a7c35501f38 100644 --- a/Compiler/BackEnd/OpenTURNS.mo +++ b/Compiler/BackEnd/OpenTURNS.mo @@ -375,7 +375,7 @@ algorithm varLst := BackendDAEUtil.getAllVarLst(dae2); varLst := List.select(varLst,BackendVariable.varHasDistributionAttribute); - Util.addInternalError(listLength(varLst) == 0, "OpenTURNS.generateDistributions: No variable in the DAE has the distribution attribute! Check your model ..."); + Util.addInternalError(List.isEmpty(varLst), "OpenTURNS.generateDistributions: No variable in the DAE has the distribution attribute! Check your model ..."); dists := List.map(varLst,BackendVariable.varDistribution); (sLst,distributionVarLst) := List.map1_2(List.threadTuple(dists,List.map(varLst,BackendVariable.varCref)),generateDistributionVariable,dae2); diff --git a/Compiler/BackEnd/Tearing.mo b/Compiler/BackEnd/Tearing.mo index 908e66d303a..ad15d4331f3 100644 --- a/Compiler/BackEnd/Tearing.mo +++ b/Compiler/BackEnd/Tearing.mo @@ -946,7 +946,7 @@ algorithm equation (_,states) = BackendVariable.getAllStateVarIndexFromVariables(vars); states = List.removeOnTrue(ass1, isAssigned, states); - true = intGt(listLength(states),0); + true = List.isNotEmpty(states); tvar = selectVarWithMostEqns(states,ass2,mt,-1,-1); then tvar; @@ -956,7 +956,7 @@ algorithm case(_,_,_,_,_) equation unsolvables = getUnsolvableVarsConsiderMatching(1,BackendVariable.varsSize(vars),mt,ass1,ass2,{}); - false = listLength(unsolvables)==0; + false = List.isEmpty(unsolvables); tvar = listGet(unsolvables,1); Debug.fcall(Flags.TEARING_DUMP,print,"tVar: " +& intString(tvar) +& " (unsolvable in omcTearingSelectTearingVar)\n\n"); then @@ -2465,13 +2465,13 @@ algorithm case(_,_,_,_,_,_,_,_,_,_,false) equation ((_,unassigned)) = List.fold(ass1In,getUnassigned,(1,{})); - false = 0 == listLength(unassigned); + false = List.isEmpty(unassigned); Debug.fcall(Flags.TEARING_DUMP, print,"\nnoncausal\n"); then (ass1In,ass2In,mIn,mtIn,orderIn,false); case(_,_,_,_,_,_,_,_,_,_,false) equation ((_,unassigned)) = List.fold(ass1In,getUnassigned,(1,{})); - true = 0 == listLength(unassigned); + true = List.isEmpty(unassigned); Debug.fcall(Flags.TEARING_DUMP, print,"\ncausal\n"); subOrder = listGet(orderIn,1); subOrder = listReverse(subOrder); @@ -2555,7 +2555,7 @@ algorithm list order; case(_,_,_,_,_,_,_,_,_,_,_) equation - true = listLength(assEq_coll) > 0; + true = List.isNotEmpty(assEq_coll); Debug.fcall(Flags.TEARING_DUMPVERBOSE, print,"assign from m\n"); ((eq_coll,eqns,vars)) = getpossibleEqnorVar((assEq_coll,m,me,listArray(ass1),listArray(ass2),mapEqnIncRow,1)); order = listGet(orderIn,1); @@ -2564,8 +2564,8 @@ algorithm then (eqns,vars,orderOut,true); case(_,_,_,_,_,_,_,_,_,_,_) equation - true = listLength(assEq_coll) == 0; - true = listLength(assVar) > 0; + true = List.isEmpty(assEq_coll); + true = List.isNotEmpty(assVar); Debug.fcall(Flags.TEARING_DUMPVERBOSE, print,"assign from mt\n"); ((_,vars,eqns)) = getpossibleEqnorVar((assVar,mt,met,listArray(ass1),listArray(ass2),mapEqnIncRow,2)); eq = listGet(eqns,1); @@ -3223,7 +3223,7 @@ algorithm then loopsOut; case(_,_,_,_,currLoop,_,_) equation - true = listLength(currLoop) > 0; + true = List.isNotEmpty(currLoop); true = indxCol == listLength(arrayGet(aIn,indxRow)); parent = indxRow; child = listGet(arrayGet(aIn,indxRow),indxCol); @@ -3416,7 +3416,7 @@ algorithm case(_,_,_,_,_,_) equation selfLoops = checkSelfLoop(sIn); - true = listLength(selfLoops)<> 0; + true = List.isNotEmpty(selfLoops); vertex = listGet(selfLoops,1); //print("selfloop vertex "+&intString(vertex)+&"\n"); parentLst = arrayGet(stIn,vertex); @@ -3541,7 +3541,7 @@ author: Waurich TUD 2012-11" list row; case(_,_,_,_,_,_) equation - true = listLength(parentLst) == 0; + true = List.isEmpty(parentLst); true = indx <= listLength(childLst); child = listGet(childLst,indx); sOut = Util.arrayReplaceAtWithFill(vertex,{},{},sIn); @@ -3553,13 +3553,13 @@ author: Waurich TUD 2012-11" (sOut,stOut); case(_,_,_,_,_,_) equation - true = listLength(parentLst) == 0; + true = List.isEmpty(parentLst); true = indx > listLength(childLst); then (sIn,stIn); case(_,_,_,_,_,_) equation - true = listLength(childLst) == 0; + true = List.isEmpty(childLst); true = indx <= listLength(parentLst); parent = listGet(parentLst,indx); stOut = Util.arrayReplaceAtWithFill(vertex,{},{},stIn); @@ -3571,7 +3571,7 @@ author: Waurich TUD 2012-11" (sOut,stOut); case(_,_,_,_,_,_) equation - true = listLength(childLst) == 0; + true = List.isEmpty(childLst); true = indx > listLength(parentLst); then (sIn,stIn); @@ -3604,7 +3604,7 @@ algorithm Var = indxVar; possibleEq = arrayGet(mt,Var); (_,_,possibleEq) = List.intersection1OnTrue(ass2In,possibleEq,intEq); - true = listLength(possibleEq)>0; + true = List.isNotEmpty(possibleEq); Eq = listGet(possibleEq,1); //print("assign \n"); //print("Var"+&intString(Var)+&" Eq"+&intString(Eq)+&"\n"); @@ -3621,7 +3621,7 @@ algorithm Var = indxVar; possibleEq = arrayGet(mt,Var); (_,_,possibleEq) = List.intersection1OnTrue(ass2In,possibleEq,intEq); - true = listLength(possibleEq)==0; + true = List.isEmpty(possibleEq); //print("reassign \n"); Eq = listGet(arrayGet(mt,Var),1); //print("1\n"); diff --git a/Compiler/BackEnd/Uncertainties.mo b/Compiler/BackEnd/Uncertainties.mo index 8f9ba754a00..1afbe56a8c1 100644 --- a/Compiler/BackEnd/Uncertainties.mo +++ b/Compiler/BackEnd/Uncertainties.mo @@ -122,7 +122,7 @@ algorithm //(dlow_1 as BackendDAE.DAE(BackendDAE.EQSYSTEM(orderedVars=allVars,orderedEqs=allEqs,m=SOME(m),mT=SOME(mt))::eqsyslist,_)) = BackendDAEUtil.mapEqSystem(dlow_1,BackendDAEUtil.getIncidenceMatrixScalarfromOptionForMapEqSystem); - true = intEq(0,listLength(eqsyslist)); + true = List.isEmpty(eqsyslist); mExt=getExtIncidenceMatrix(m); //dumpExtIncidenceMatrix(mExt); @@ -208,7 +208,7 @@ algorithm (setC,removed_equations_squared)=getEquationsForKnownsSystem(mExt,knowns,unknowns,setS,allEqs,allVars,sharedVars,mapIncRowEqn); - print(Util.if_(listLength(removed_equations_squared)>0,"Warning: the system is ill-posed. One or more equations have been removed from squared system of knowns.\n","")); + print(Util.if_(List.isNotEmpty(removed_equations_squared),"Warning: the system is ill-posed. One or more equations have been removed from squared system of knowns.\n","")); printSep(getMathematicaText("Equations removed from squared blocks (with more than one equation)")); printSep(equationsToMathematicaGrid(removed_equations_squared,allEqs,allVars,sharedVars,mapIncRowEqn)); @@ -728,7 +728,7 @@ algorithm //print("Cleaning up system of knowns.."); knownsSystem = removeEquations(m,setS); knownsSystem = removeUnrelatedEquations(knownsSystem,knowns); - true=intEq(listLength(knownsSystem),0); + true = List.isEmpty(knownsSystem); print("Warning: The system is ill-posed. There are no remaining equations containing the knowns.\n"); then ({},{}); @@ -1228,12 +1228,12 @@ mOut:=matchcontinue(m,set,acc) case((eq,vars)::t,_,_) equation newVars = List.filter1OnTrue(vars,removeVarsNotInSet_helper,set); - true = intEq(listLength(newVars),0); + true = List.isEmpty(newVars); then removeVarsNotInSet(t,set,acc); case((eq,vars)::t,_,_) equation newVars = List.filter1OnTrue(vars,removeVarsNotInSet_helper,set); - false = intEq(listLength(newVars),0); + false = List.isNotEmpty(newVars); then removeVarsNotInSet(t,set,(eq,newVars)::acc); end matchcontinue; end removeVarsNotInSet; @@ -1331,7 +1331,7 @@ algorithm then (); case(_,h::t,_) equation - true=intEq(listLength(removeUnrelatedEquations(m,{h})),0); + true=List.isEmpty(removeUnrelatedEquations(m,{h})); not_found_var=BackendVariable.getVarAt(variables,h); str = ComponentReference.crefStr(BackendVariable.varCref(not_found_var)); print("Warning: The variable '"+&str+&"' was not found in the system of knowns\n"); @@ -1339,7 +1339,7 @@ algorithm then (); case(_,h::t,_) equation - false=intEq(listLength(removeUnrelatedEquations(m,{h})),0); + false=List.isEmpty(removeUnrelatedEquations(m,{h})); checkSystemContainsVars(m,t,variables); then (); end matchcontinue; @@ -1583,7 +1583,7 @@ protected function containsAny protected list m3; algorithm m3:=List.intersectionOnTrue(m1,m2,intEq); - out:=listLength(m3)>0; + out:=List.isNotEmpty(m3); end containsAny; protected function containsAll diff --git a/Compiler/FrontEnd/InnerOuter.mo b/Compiler/FrontEnd/InnerOuter.mo index 971fe30607d..eeb118e9918 100644 --- a/Compiler/FrontEnd/InnerOuter.mo +++ b/Compiler/FrontEnd/InnerOuter.mo @@ -1728,7 +1728,7 @@ algorithm case(INST_INNER(innerPrefix, name, io, fullName, typePath, scope, instResult, outers, _)) equation outers = List.uniqueOnTrue(outers, ComponentReference.crefEqualNoStringCompare); - strOuters = Util.if_(listLength(outers) == 0, + strOuters = Util.if_(List.isEmpty(outers), "", " Referenced by 'outer' components: {" +& stringDelimitList(List.map(outers, ComponentReference.printComponentRefStr), ", ") +& "}"); diff --git a/Compiler/FrontEnd/Inst.mo b/Compiler/FrontEnd/Inst.mo index 5f3b443197b..3c82902b8a7 100644 --- a/Compiler/FrontEnd/Inst.mo +++ b/Compiler/FrontEnd/Inst.mo @@ -3005,7 +3005,7 @@ algorithm /* Inherits baseclass -and- has components */ case (cache,env,ih,store,{SCode.EXTENDS(baseClassPath = path,modifications = mod)},_,mods,inst_dims,_,_,_) equation - true = (listLength(inSCodeElementLst3) > 0); + true = (List.isNotEmpty(inSCodeElementLst3)); ErrorExt.setCheckpoint("instBasictypeBaseclass2") "rolled back or deleted inside call below"; instBasictypeBaseclass2(cache,env,ih,store,inSCodeElementLst2,inSCodeElementLst3,mods,inst_dims,className,info,stopInst); then diff --git a/Compiler/FrontEnd/InstUtil.mo b/Compiler/FrontEnd/InstUtil.mo index e9a47cb86c9..a9a1affc2e8 100644 --- a/Compiler/FrontEnd/InstUtil.mo +++ b/Compiler/FrontEnd/InstUtil.mo @@ -1030,7 +1030,7 @@ algorithm equation lst = List.map(inComps, Util.tuple21); lst = extractConstantPlusDeps2(lst, ocr, allComps, className, {}); - true = listLength(lst) >= 1; + true = List.isNotEmpty(lst); lst = listReverse(lst); oel = List.filter1OnTrue(inComps, elementNameMember, lst); then @@ -1082,7 +1082,7 @@ algorithm case(_, SOME(cr), _, _) equation outComps = extractConstantPlusDeps2(inComps, ocr, allComps, className,{}); - true = listLength(outComps) >= 1; + true = List.isNotEmpty(outComps); outComps = listReverse(outComps); then outComps; diff --git a/Compiler/FrontEnd/InstVar.mo b/Compiler/FrontEnd/InstVar.mo index acd26b09bd2..f8277f372d5 100644 --- a/Compiler/FrontEnd/InstVar.mo +++ b/Compiler/FrontEnd/InstVar.mo @@ -1001,7 +1001,7 @@ algorithm PrefixUtil.prefixToCrefOpt(inPrefix), NONE(), NONE()); // Instantiate the components binding. - mod = Util.if_(listLength(inSubscripts) > 0 and not SCode.isParameterOrConst(vt) and not ClassInf.isFunctionOrRecord(inState) and not Types.isComplexType(Types.arrayElementType(ty)) and not Types.isExternalObject(Types.arrayElementType(ty)) and not Config.scalarizeBindings(),DAE.NOMOD(),inMod); + mod = Util.if_(List.isNotEmpty(inSubscripts) and not SCode.isParameterOrConst(vt) and not ClassInf.isFunctionOrRecord(inState) and not Types.isComplexType(Types.arrayElementType(ty)) and not Types.isExternalObject(Types.arrayElementType(ty)) and not Config.scalarizeBindings(),DAE.NOMOD(),inMod); opt_binding = InstBinding.makeVariableBinding(ty, mod, NFInstUtil.toConst(vt), inPrefix, inName, source); start = InstBinding.instStartBindingExp(inMod /* Yup, let's keep the start-binding. It seems sane. */, ty, vt); diff --git a/Compiler/FrontEnd/Mod.mo b/Compiler/FrontEnd/Mod.mo index c9ea7851d66..e5eb0895750 100644 --- a/Compiler/FrontEnd/Mod.mo +++ b/Compiler/FrontEnd/Mod.mo @@ -2435,7 +2435,7 @@ algorithm prefix = SCodeDump.finalStr(finalPrefix) +& SCodeDump.eachStr(eachPrefix); s1 = printSubs1Str(subs); s1_1 = stringDelimitList(s1, ", "); - s1_1 = Util.if_(listLength(subs)>=1," {" +& s1_1 +& "} ",s1_1); + s1_1 = Util.if_(List.isNotEmpty(subs)," {" +& s1_1 +& "} ",s1_1); s2 = printEqmodStr(eq); str = stringAppendList({prefix,s1_1,s2}); then @@ -3255,7 +3255,7 @@ algorithm equation //Debug.fprint(Flags.REDECL,"Removing redeclare mods: " +& componentModified +&" before" +& Mod.printModStr(inmod) +& "\n"); redecls = removeRedeclareMods(redecls,componentModified); - outmod = Util.if_(listLength(redecls) > 0,DAE.REDECL(f,e,redecls), DAE.NOMOD()); + outmod = Util.if_(List.isNotEmpty(redecls),DAE.REDECL(f,e,redecls), DAE.NOMOD()); //Debug.fprint(Flags.REDECL,"Removing redeclare mods: " +& componentModified +&" after" +& Mod.printModStr(outmod) +& "\n"); then outmod; diff --git a/Makefile.common b/Makefile.common index ddb16cbbb03..2b575e70e7c 100644 --- a/Makefile.common +++ b/Makefile.common @@ -22,7 +22,7 @@ INSTALL_MANDIR = ${DESTDIR}${datadir}/man/ INSTALL_JAVADIR = ${DESTDIR}${datadir}/omc/java INSTALL_LOCALEDIR = ${DESTDIR}${datadir}/locale -.PHONY : interactive omc release qtclient mosh all mkbuilddirs fmi test install-dirs susan susan_all susgen sustst install-python install-openturns runtimeCPPinstall boehm-gc +.PHONY : interactive omc release qtclients mosh all mkbuilddirs fmi test install-dirs susan susan_all susgen sustst install-python install-openturns runtimeCPPinstall boehm-gc mkbuilddirs: if [ "$(APP)" = ".app" ]; then mkdir -p $(builddir_app); fi