Skip to content

Commit

Permalink
[Janitor mode] Fix whitespace
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20290 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
OpenModelica-Hudson committed Apr 28, 2014
1 parent 9779788 commit ee1e767
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Compiler/BackEnd/EvaluateFunctions.mo
Expand Up @@ -1095,8 +1095,8 @@ algorithm
(exp2,_) = ExpressionSimplify.simplify(exp2);
expLst = Expression.getComplexContents(exp2);
//print("SIMPLIFIED\n"+&stringDelimitList(List.map({exp2},ExpressionDump.printExpStr),"\n")+&"\n");
// add the replacements for the addStmts

// add the replacements for the addStmts

// check if its constant, a record or a tuple
isCon = Expression.isConst(exp2);
Expand Down Expand Up @@ -1133,7 +1133,7 @@ algorithm
//alg = Util.if_(isTpl,DAE.STMT_TUPLE_ASSIGN(typ,tplExpsLHS,exp2,source),alg);
stmts1 = Util.if_(isTpl,tplStmts,{alg});
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP),print,"evaluated assignment to:\n"+&stringDelimitList(List.map(stmts1,DAEDump.ppStatementStr),"\n")+&"\n");

//stmts1 = listAppend({alg},lstIn);
stmts1 = listAppend(stmts1,lstIn);
//print("\nthe traverse LIST after :"+&stringDelimitList(List.map(stmts1,DAEDump.ppStatementStr),"\n")+&"\n");
Expand All @@ -1153,7 +1153,7 @@ algorithm
equation
alg = List.first(algsIn);
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP),print,"IF-statement:\n"+&DAEDump.ppStatementStr(alg));

// get all stmts in the function and the assigned crefs (need the outputs in order to remove the replacements if nothing can be evaluated)
stmtsLst = getDAEelseStatemntLsts(else_,{});
stmtsLst = listReverse(stmtsLst);
Expand All @@ -1162,10 +1162,10 @@ algorithm
lhsExps = List.fold1(allStmts,getStatementLHSScalar,funcTree,{});
lhsExps = List.unique(lhsExps);
outputs = List.map(lhsExps,Expression.expCref);

//check if the conditions can be evaluated, get evaluated stmts
(isEval,stmts1) = evaluateIfStatement(alg,FUNCINFO(replIn,funcTree,idx));

// if its not definite which case, try to predict a constant output, maybe its partially constant, then remove function outputs replacements
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP) and not isEval,print,"-->try to predict the outputs \n");
((stmtsNew,addStmts),FUNCINFO(repl,funcTree,idx)) = Debug.bcallret2_2(not isEval ,predictIfOutput,alg,FUNCINFO(replIn,funcTree,idx),(stmts1,{}),FUNCINFO(replIn,funcTree,idx));
Expand Down Expand Up @@ -1255,7 +1255,7 @@ algorithm
end matchcontinue;
end evaluateFunctions_updateStatement;

protected function evaluateIfStatement"check if the cases are constant and if so evaluate them.
protected function evaluateIfStatement"check if the cases are constant and if so evaluate them.
author: Waurich TUD 2014-04"
input DAE.Statement stmtIn;
input FuncInfo info;
Expand All @@ -1280,25 +1280,25 @@ algorithm
(exp1,_) = ExpressionSimplify.simplify(exp1);
isCon = Expression.isConst(exp1);
isIf = Debug.bcallret1(isCon,Expression.getBoolConst,exp1,false);

// check if its the IF case, if true then evaluate:
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP),print,"-->is the if const? "+&boolString(isCon)+&" and is it the if case ? "+&boolString(isIf)+&"\n");
//(stmts1,(funcTree,repl,idx)) = Debug.bcallret3_2(isIf and isCon,evaluateFunctions_updateStatement,stmtsIf,(funcTree,replIn,idx),lstIn,stmtsIf,(funcTree,replIn,idx));
(stmts1,(funcTree,repl,idx)) = Debug.bcallret3_2(isIf and isCon,evaluateFunctions_updateStatement,stmtsIf,(funcTree,replIn,idx),{},{stmtIn},(funcTree,replIn,idx)); // without listIn

// if its definitly not the if, check the else
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP) and not isIf,print,"-->try to check if its another case\n");
(stmtsElse,isElse) = Debug.bcallret2_2(isCon and not isIf,evaluateElse,else_,info,{stmtIn},false);
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP) and not isIf,print,"-->is it an other case? "+&boolString(isElse)+&"\n");
Debug.bcall1(Flags.isSet(Flags.EVAL_FUNC_DUMP) and not isIf,print,"-->is it an other case? "+&boolString(isElse)+&"\n");
(stmts1,(funcTree,repl,idx)) = Debug.bcallret3_2(isCon and isElse,evaluateFunctions_updateStatement,stmtsElse,(funcTree,replIn,idx),{},stmts1,(funcTree,replIn,idx));
eval = isCon and (isIf or isElse);
then
(eval,stmts1);
else
equation
print("evaluateIfStatement failed \n");
print("evaluateIfStatement failed \n");
then
fail();
fail();
end matchcontinue;
end evaluateIfStatement;

Expand Down Expand Up @@ -1339,7 +1339,7 @@ algorithm
equation
then
({},true);
end matchcontinue;
end matchcontinue;
end evaluateElse;

protected function addTplReplacements
Expand Down Expand Up @@ -1557,9 +1557,9 @@ algorithm
equation
DAE.CALL(path=_,expLst=_,attr=_) = rhs;
((rhs,lhs,addEqs,funcs,idx)) = evaluateConstantFunction(rhs,lhs,funcs,idx);

stmts = List.map(addEqs,equationToStmt);

stmts = listAppend(stmts,stmtsIn);
then
((rhs,true,(lhs,funcs,idx,stmts)));
Expand Down Expand Up @@ -1919,7 +1919,7 @@ protected
BackendVarTransform.VariableReplacements repl;
algorithm
repl := BackendVarTransform.emptyReplacements();
replOut := collectReplacements1(stmtsIn,repl);
replOut := collectReplacements1(stmtsIn,repl);
end collectReplacements;

protected function collectReplacements1"
Expand Down Expand Up @@ -1977,7 +1977,7 @@ algorithm
print("collectReplacements failed\n");
then
fail();
end matchcontinue;
end matchcontinue;
end collectReplacements1;

protected function getOnlyConstantReplacements"removes replacement rules that do not have a constant expression as value
Expand Down

0 comments on commit ee1e767

Please sign in to comment.