Skip to content

Commit

Permalink
Revert "Access iterators locally in alg loops as well"
Browse files Browse the repository at this point in the history
This reverts commit a37f8ba.
See Modelica.Fluid.Examples.HeatingSystem
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Mar 31, 2016
1 parent 3b38cab commit 8d51784
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Compiler/Template/CodegenCppCommon.tpl
Expand Up @@ -23,7 +23,14 @@ template cref(ComponentRef cr, Boolean useFlatArrayNotation)
case WILD(__) then ''
else "_"+crefToCStr(cr, useFlatArrayNotation)
end cref;

template localcref(ComponentRef cr, Boolean useFlatArrayNotation)
"Generates C equivalent name for component reference."
::=
match cr
case CREF_IDENT(ident = "time") then "_simTime"
case WILD(__) then ''
else crefToCStr(cr,useFlatArrayNotation)
end localcref;
template subscriptsToCStr(list<Subscript> subscripts, Boolean useFlatArrayNotation)
::=
if subscripts then
Expand Down Expand Up @@ -222,10 +229,11 @@ template representationCref(ComponentRef inCref, SimCode simCode ,Text& extraFun
case SIMVAR(index=-2) then
match context
case JACOBIAN_CONTEXT() then
'_<%crefToCStr(inCref, false)%>'
'_<%crefToCStr(inCref,false)%>'
case ALGLOOP_CONTEXT(__) then
'_system->_<%crefToCStr(inCref,false)%>'
else
// a local variable, like an iterator
'<%crefToCStr(inCref, useFlatArrayNotation)%>'
'<%localcref(inCref, useFlatArrayNotation)%>'
end match
else
match context
Expand Down

0 comments on commit 8d51784

Please sign in to comment.