Skip to content

Commit

Permalink
fix initialization of array output and implement assignment of a rang…
Browse files Browse the repository at this point in the history
…e to an array (#3263)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25402 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
rfranke committed Apr 6, 2015
1 parent f98f34d commit 4661b7e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -4883,7 +4883,7 @@ match var
case var as VARIABLE(__) then
match value
case SOME(CREF(componentRef = cr)) then
'<%contextCref(cr,contextFunction, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)%> = <%outStruct%>.targTest9<%i%><%\n%>'
if outStruct then '<%contextCref(cr,contextFunction, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)%> = <%outStruct%>.targTest9<%i%><%\n%>' else '<%\n%>'
case SOME(arr as ARRAY(__)) then
let arrayExp = '<%daeExp(arr, contextFunction, &varInits, &varDecls, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)%>'
<<
Expand Down Expand Up @@ -14397,9 +14397,12 @@ template algStmtAssignArr(DAE.Statement stmt, Context context,
::=
match stmt
case STMT_ASSIGN_ARR(exp=RANGE(__), lhs=CREF(componentRef=cr), type_=t) then
let &preExp = buffer "" /*BUFD*/
let expPart = daeExpRange(exp, context, &preExp /*BUFC*/, &varDecls /*BUFD*/, simCode, &extraFuncs, &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)
let cref = contextArrayCref(cr, context)
<<
STMT_ASSIGN_ARR RANGE
fillArrayFromRange(t,exp,cr,context,&varDecls)
<%preExp%>
<%cref%>.assign(<%expPart%>);
>>
case STMT_ASSIGN_ARR(exp=e as CALL(__), lhs=CREF(componentRef=cr), type_=t) then
let &preExp = buffer "" /*BUFD*/
Expand Down

0 comments on commit 4661b7e

Please sign in to comment.