Skip to content

Commit

Permalink
- fix testsuite
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12117 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Jun 19, 2012
1 parent 4eed977 commit af4d6d4
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions Compiler/susan_codegen/SimCode/CodegenC.tpl
Expand Up @@ -951,7 +951,7 @@ template functionODE_system(list<SimEqSystem> derivativEquations, Integer n)
::=
let &varDecls = buffer ""
let &tmp = buffer ""
let odeEqs = derivativEquations |> eq => equationNames_(eq); separator="\n"
let odeEqs = derivativEquations |> eq => equationNames_(eq,contextSimulationNonDiscrete); separator="\n"
<<
<%&tmp%>
static void functionODE_system<%n%>(DATA *data,int omc_thread_number)
Expand Down Expand Up @@ -1040,7 +1040,7 @@ template functionAlgebraic(list<SimEqSystem> algebraicEquations)
let &varDecls = buffer "" /*BUFD*/
let &tmp = buffer ""
let algEquations = (algebraicEquations |> eq =>
equationNames_(eq)
equationNames_(eq,contextSimulationNonDiscrete)
;separator="\n")
<<
<%tmp%>
Expand Down Expand Up @@ -1663,6 +1663,9 @@ template equation_(SimEqSystem eq, Context context, Text &varDecls /*BUFP*/, Tex
let ix = equationIndex(eq) /*System.tmpTickIndex(10)*/
let &tmp = buffer ""
let &varD = buffer ""
let disc = match context
case SIMULATION(genDiscrete=true) then 1
else 0
let x = match eq
case e as SES_SIMPLE_ASSIGN(__)
then equationSimpleAssign(e, context, &varD /*BUFD*/)
Expand All @@ -1681,31 +1684,42 @@ template equation_(SimEqSystem eq, Context context, Text &varDecls /*BUFP*/, Tex
let &eqs +=
<<

void eqFunction_<%ix%>(DATA *data) {
void eqFunction_<%ix%>(DATA *data, char discreteCall) {
<%&varD%>
<%x%>
}

>>
<<
eqFunction_<%ix%>(data);
eqFunction_<%ix%>(data,<%disc%>);
>>
)
end equation_;

template equationNames_(SimEqSystem eq)
template equationNames_(SimEqSystem eq, Context context)
"Generates an equation.
This template should not be used for a SES_RESIDUAL.
Residual equations are handled differently."
::=
match context
case SIMULATION(genDiscrete=true) then
match eq
case e as SES_ALGORITHM(statements={})
then ""
else
let ix = equationIndex(eq)
<<
eqFunction_<%ix%>(data);
eqFunction_<%ix%>(data,1);
>>
else
match eq
case e as SES_ALGORITHM(statements={})
then ""
else
let ix = equationIndex(eq)
<<
eqFunction_<%ix%>(data,0);
>>
end equationNames_;

template old_equation_(SimEqSystem eq, Context context, Text &varDecls)
Expand Down Expand Up @@ -4456,21 +4470,21 @@ end algStmtNoretcall;
template algStmtWhen(DAE.Statement when, Context context, Text &varDecls /*BUFP*/)
"Generates a when algorithm statement."
::=
match context
case SIMULATION(genDiscrete=true) then
match when
match when
case STMT_WHEN(__) then
let preIf = algStatementWhenPre(when, &varDecls /*BUFD*/)
let statements = (statementLst |> stmt =>
algStatement(stmt, context, &varDecls /*BUFD*/)
;separator="\n")
let else = algStatementWhenElse(elseWhen, &varDecls /*BUFD*/)
<<
<%preIf%>
if (<%helpVarIndices |> idx => 'data->simulationInfo.helpVars[<%idx%>] && !data->simulationInfo.helpVarsPre[<%idx%>] /* edge */' ;separator=" || "%>) {
<%statements%>
}
<%else%>
if (discreteCall == 1) {
<%preIf%>
if (<%helpVarIndices |> idx => 'data->simulationInfo.helpVars[<%idx%>] && !data->simulationInfo.helpVarsPre[<%idx%>] /* edge */' ;separator=" || "%>) {
<%statements%>
}
<%else%>
}
>>
end match
end algStmtWhen;
Expand Down

0 comments on commit af4d6d4

Please sign in to comment.