Skip to content

Commit

Permalink
- Merging
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Oct 27, 2010
2 parents 6627e96 + a5de90b commit 75bf510
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions Compiler/SimCode.mo
Expand Up @@ -1123,11 +1123,14 @@ in a list. Removes duplicates."
list<DAE.Exp> explist,fcallexps,fcallexps_1,fcallexps_2;
list<Absyn.Path> calledfuncs;
algorithm
explist := DAELow.getAllExps(dlow);
fcallexps := getMatchingExpsList(explist, matchCalls);
fcallexps_1 := Util.listSelect(fcallexps, isNotBuiltinCall);
fcallexps_2 := getMatchingExpsList(explist, matchFnRefs);
calledfuncs := Util.listMap(listAppend(fcallexps_1,fcallexps_2), getCallPath);
//explist := DAELow.getAllExps(dlow);
//fcallexps := getMatchingExpsList(explist, matchCalls);
fcallexps := DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchCallsAndFnRefs);
//fcallexps_1 := Util.listSelect(fcallexps, isNotBuiltinCall);
//fcallexps_2 := getMatchingExpsList(explist, matchFnRefs);
//fcallexps_2 := DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchFnRefs);
//calledfuncs := Util.listMap(listAppend(fcallexps_1,fcallexps_2), getCallPath);
calledfuncs := Util.listMap(fcallexps, getCallPath);
res := removeDuplicatePaths(calledfuncs);
end getCalledFunctions;

Expand All @@ -1149,7 +1152,8 @@ algorithm
equation
true = RTOpts.acceptMetaModelicaGrammar();
explist = DAELow.getAllExps(dlow);
fcallexps = getMatchingExpsList(explist, matchFnRefs);
//fcallexps = getMatchingExpsList(explist, matchFnRefs);
fcallexps = DAELow.traverseDAELowExps(dlow,true,getMatchingExps,matchFnRefs);
calledfuncs = Util.listMap(fcallexps, getCallPath);
res = removeDuplicatePaths(calledfuncs);
then res;
Expand Down Expand Up @@ -7437,6 +7441,30 @@ algorithm
end matchcontinue;
end getMatchingExps;

protected function matchCallsAndFnRefs
"calls matchCalls and matchFnRefs"
input DAE.Exp inExpr;
output list<DAE.Exp> outExprLst;
algorithm
outExprLst := matchcontinue (inExpr)
local list<DAE.Exp> explst,explst1,explst_1,explst2;
case (inExpr)
equation
explst = matchCalls(inExpr);
explst_1 = Util.listSelect(explst, isNotBuiltinCall);
explst1 = matchFnRefs(inExpr);
explst2 = listAppend(explst,explst_1);
then
explst2;
case (inExpr)
equation
failure(explst = matchCalls(inExpr));
explst1 = matchFnRefs(inExpr);
then
explst1;
end matchcontinue;
end matchCallsAndFnRefs;

protected function matchCalls
"Used together with getMatchingExps"
input DAE.Exp inExpr;
Expand Down

0 comments on commit 75bf510

Please sign in to comment.