Skip to content

Commit

Permalink
Translate to iterative Tpl.mo
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Mar 20, 2016
1 parent 67f1d6b commit b9f7f01
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -4149,18 +4149,12 @@ end functionlinearmodel;
template getVarName(list<SimVar> simVars, String arrayName, Integer arraySize) "template getVarName
Generates name for a varables."
::=
match simVars
case {} then
<<
>>
case (var :: restVars) then
let rest = getVarName(restVars, arrayName, arraySize)
let arrindex = decrementInt(arraySize,listLength(restVars))
match var
simVars |> var hasindex arrindex fromindex 1 =>
(match var
case SIMVAR(__) then
<<Real <%arrayName%>_<%crefM(name)%> = <%arrayName%>[<%arrindex%>];\n <%rest%>>>
end match
end match
' Real <%arrayName%>_<%crefM(name)%> = <%arrayName%>[<%arrindex%>];\n'
end match)
; empty
end getVarName;

template genMatrix(String name, Integer row, Integer col) "template genMatrix
Expand Down

0 comments on commit b9f7f01

Please sign in to comment.