Skip to content

Commit

Permalink
- Util.mo
Browse files Browse the repository at this point in the history
  switch function arguments from listRemoveOnTrue to use it in compination with listFold_1
- BackendDAECreate.mo
  - remove all output variables from input variables for algorithm sections
 -> now testsuite works (mosfiles) 

git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6815 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Nov 1, 2010
1 parent c61f046 commit 354bceb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -35,4 +35,4 @@ SET(OMC_DEBUG ${OMCTRUNCHOME}/build/bin/omcd.exe)
#BUILDMODEL(BouncingBall ${CMAKE_CURRENT_SOURCE_DIR}/testsuite/mofiles +d=bltdump)
#BUILDMODEL(Simple ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Test +d=bltdump)
#BUILDMODEL(CombiTable2DTest ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Test +d=bltdump "")
BUILDMODEL(Delay ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Test +d=bltdump "")
#BUILDMODEL(AlgorithmForInClass ${CMAKE_CURRENT_SOURCE_DIR}/build/bin/Test +d=bltdump "")
4 changes: 3 additions & 1 deletion Compiler/BackendDAECreate.mo
Expand Up @@ -1587,7 +1587,8 @@ public function lowerAlgorithmInputsOutputs
This function finds the inputs and the outputs of an algorithm.
An input is all values that are reffered on the right hand side of any
statement in the algorithm and an output is a variables belonging to the
variables that are assigned a value in the algorithm."
variables that are assigned a value in the algorithm. If a variable is an
input and an output it will be treated as an output."
input BackendDAE.Variables inVariables;
input DAE.Algorithm inAlgorithm;
output tuple<list<DAE.Exp>,list<DAE.Exp>> outTplExpExpLst;
Expand All @@ -1605,6 +1606,7 @@ algorithm
((inputs2,outputs2)) = lowerAlgorithmInputsOutputs(vars, DAE.ALGORITHM_STMTS(ss));
inputs = Util.listUnionOnTrue(inputs1, inputs2, Expression.expEqual);
outputs = Util.listUnionOnTrue(outputs1, outputs2, Expression.expEqual);
inputs = Util.listFold1(outputs,Util.listRemoveOnTrue,Expression.expEqual,inputs);
then
((inputs,outputs));
end matchcontinue;
Expand Down
14 changes: 7 additions & 7 deletions Compiler/Util.mo
Expand Up @@ -3966,8 +3966,8 @@ public function listRemoveOnTrue "
Go trough a list and when function is true, remove that element.
"
input Type_a inTypeALst1;
input list<Type_a> inTypeALst2;
input FuncTypeType_aType_aToBoolean inFuncTypeTypeATypeAToBoolean3;
input list<Type_a> inTypeALst2;
output list<Type_a> outTypeALst;
replaceable type Type_a subtypeof Any;
partial function FuncTypeType_aType_aToBoolean
Expand All @@ -3977,22 +3977,22 @@ Go trough a list and when function is true, remove that element.
end FuncTypeType_aType_aToBoolean;
algorithm
outTypeALst:=
matchcontinue (inTypeALst1,inTypeALst2,inFuncTypeTypeATypeAToBoolean3)
matchcontinue (inTypeALst1,inFuncTypeTypeATypeAToBoolean3,inTypeALst2)
local
list<Type_a> res,r1,xs,lst2;
FuncTypeType_aType_aToBoolean p;
Type_a x,y;
case (x,{},p) then {};
case (x,y::xs,p)
case (x,p,{}) then {};
case (x,p,y::xs)
equation
true = p(x,y);
res = listRemoveOnTrue(x, xs, p);
res = listRemoveOnTrue(x, p, xs);
then
res;
case (x,y::xs,p)
case (x,p,y::xs)
equation
false = p(x,y);
res = listRemoveOnTrue(x, xs, p);
res = listRemoveOnTrue(x, p, xs);
then
y::res;
end matchcontinue;
Expand Down

0 comments on commit 354bceb

Please sign in to comment.