Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
[Cpp] Skip array subscripts in cref names if not NF_SCALARIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Nov 7, 2018
1 parent 9188bd5 commit 98896ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Compiler/Template/CodegenCppCommon.tpl
Expand Up @@ -59,14 +59,15 @@ template subscriptToCStr(Subscript subscript)
end subscriptToCStr;

template crefToCStrForArray(ComponentRef cr, Text& dims)
"Convert array cref to cstr without subscripts at idents."
"Convert array cref to cstr. Skip subscripts if not NF_SCALARIZE."
::=
match cr
case CREF_IDENT(__) then
let &dims+=listLength(subscriptLst)
'<%ident%>_'
case CREF_QUAL(__) then
'<%ident%>_P_<%crefToCStrForArray(componentRef,dims)%>'
let subs = if Flags.isSet(Flags.NF_SCALARIZE) then subscriptsToCStrForArray(subscriptLst)
'<%ident%><%subs%>_P_<%crefToCStrForArray(componentRef,dims)%>'
case WILD(__) then ' '
else "CREF_NOT_IDENT_OR_QUAL"
end crefToCStrForArray;
Expand Down
1 change: 1 addition & 0 deletions Compiler/Template/SimCodeTV.mo
Expand Up @@ -3539,6 +3539,7 @@ package Flags
constant DebugFlag HARDCODED_START_VALUES;
constant DebugFlag OMC_RECORD_ALLOC_WORDS;
constant DebugFlag OMC_RELOCATABLE_FUNCTIONS;
constant DebugFlag NF_SCALARIZE;
constant ConfigFlag NUM_PROC;
constant ConfigFlag HPCOM_CODE;
constant ConfigFlag PROFILING_LEVEL;
Expand Down

0 comments on commit 98896ae

Please sign in to comment.