Skip to content

Commit 8d801b8

Browse files
committed
fix in cpp template for init alias vars and smaller fixes
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20723 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 15a77d4 commit 8d801b8

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package CodegenCpp
22

33
import interface SimCodeTV;
4-
4+
import CodegenUtil.*;
55
// SECTION: SIMULATION TARGET, ROOT TEMPLATE
66

77

@@ -1064,7 +1064,7 @@ template simulationResults(Boolean test, SimCode simCode)
10641064
::=
10651065
match simCode
10661066
case SIMCODE(modelInfo=MODELINFO(__),makefileParams=MAKEFILE_PARAMS(__),simulationSettingsOpt = SOME(settings as SIMULATION_SETTINGS(__))) then
1067-
let results = if test then "" else '<%makefileParams.compileDir%>/'
1067+
let results = if test then "" else '<%makefileParamst.compileDir%>/'
10681068
<<
10691069
<%results%><%fileNamePrefix%>_res.<%settings.outputFormat%>
10701070
>>
@@ -2123,13 +2123,13 @@ case FUNCTION(outVars={}) then
21232123
case FUNCTION(outVars=_) then
21242124
let fname = underscorePath(name)
21252125
<<
2126-
/* functionHeaderRegularFunction2 */
2126+
/* functionHeaderRegularFunction2*/
21272127
<%fname%>RetType <%fname%>(<%functionArguments |> var => funArgDefinition(var,simCode) ;separator=", "%>);
21282128
>>
21292129
case EXTERNAL_FUNCTION(outVars=var::_) then
21302130
let fname = underscorePath(name)
21312131
<<
2132-
/* functionHeaderRegularFunction2 */
2132+
/* functionHeaderRegularFunction2*/
21332133
<%fname%>RetType <%fname%>(<%funArgs |> var => funArgDefinition(var,simCode) ;separator=", "%>);
21342134
>>
21352135
case EXTERNAL_FUNCTION(outVars={}) then
@@ -5430,20 +5430,20 @@ template initAliasValst(Text &varDecls /*BUFP*/,list<SimVar> varsLst, SimCode si
54305430
case vStr as "(0)" then
54315431
'<%preExp%>
54325432
<%getAliasVarName(sv.aliasvar, simCode,context)%>=<%vStr%>;//<%cref(sv.name)%>
5433-
_start_values["<%getAliasVarName(sv.aliasvar, simCode,context)%>"]=<%vStr%>;'
5433+
_start_values["<%cref(sv.name)%>"]=<%vStr%>;'
54345434
case vStr as "" then
54355435
'<%preExp%>
54365436
<%getAliasVarName(sv.aliasvar, simCode,context)%>=0;//<%cref(sv.name)%>
5437-
_start_values["<%getAliasVarName(sv.aliasvar, simCode,context)%>"]=<%vStr%>;'
5437+
_start_values["<%cref(sv.name)%>"]=<%vStr%>;'
54385438
case vStr then
54395439
'<%preExp%>
54405440
<%getAliasVarName(sv.aliasvar, simCode,context)%>=<%vStr%>;//<%cref(sv.name)%>
5441-
_start_values["<%getAliasVarName(sv.aliasvar, simCode,context)%>"]=<%vStr%>;'
5441+
_start_values["<%cref(sv.name)%>"]=<%vStr%>;'
54425442
end match
54435443
else
54445444
'<%preExp%>
54455445
<%getAliasVarName(sv.aliasvar, simCode,context)%>=<%startValue(sv.type_)%>;////<%crefStr(sv.name)%>
5446-
_start_values["<%getAliasVarName(sv.aliasvar, simCode,context)%>"]=<%startValue(sv.type_)%>;'
5446+
_start_values["<%cref(sv.name)%>"]=<%startValue(sv.type_)%>;'
54475447
;separator="\n"
54485448
end initAliasValst;
54495449
@@ -5614,7 +5614,7 @@ template expTypeShort(DAE.Type type)
56145614
case T_ARRAY(__) then expTypeShort(ty)
56155615
case T_COMPLEX(complexClassType=EXTERNAL_OBJ(__))
56165616
then "void*"
5617-
case T_COMPLEX(__) then 'complex3'
5617+
case T_COMPLEX(__) then 'ComplexType'
56185618
case T_METATYPE(__) case T_METABOXED(__) then "metatype"
56195619
case T_FUNCTION_REFERENCE_VAR(__) then "fnptr"
56205620
else "expTypeShort:ERROR"
@@ -5645,7 +5645,7 @@ template arrayCrefCStr2(ComponentRef cr)
56455645
case CREF_QUAL(__) then '<%unquoteIdentifier(ident)%>_P_<%arrayCrefCStr2(componentRef)%>'
56465646
else "CREF_NOT_IDENT_OR_QUAL"
56475647
end arrayCrefCStr2;
5648-
5648+
/*
56495649
template underscorePath(Path path)
56505650
"Generate paths with components separated by underscores.
56515651
Replaces also the . in identifiers with _.
@@ -5659,7 +5659,7 @@ template underscorePath(Path path)
56595659
case FULLYQUALIFIED(__) then
56605660
underscorePath(path)
56615661
end underscorePath;
5662-
5662+
*/
56635663
template replaceDotAndUnderscore(String str)
56645664
"Replace _ with __ and dot in identifiers with _"
56655665
::=
@@ -10208,12 +10208,12 @@ case MODELINFO(vars=SIMVARS(__)) then
1020810208

1020910209
void <%lastIdentOfPath(name)%>::getString(string* z)
1021010210
{
10211-
/*
10211+
1021210212
<%System.tmpTickReset(0)%>
1021310213
<%vars.stringAlgVars |> var => giveVariablesDefault(var, System.tmpTick()) ;separator="\n"%>
1021410214
<%vars.stringParamVars |> var => giveVariablesDefault(var, System.tmpTick()) ;separator="\n"%>
1021510215
<%vars.stringAliasVars |> var => giveVariablesDefault(var, System.tmpTick()) ;separator="\n"%>
10216-
*/
10216+
1021710217
}
1021810218

1021910219
void <%lastIdentOfPath(name)%>::setReal(const double* z)
@@ -10267,7 +10267,7 @@ template giveVariablesDefault(SimVar simVar, Integer valueReference)
1026710267
::=
1026810268
match simVar
1026910269
case SIMVAR(__) then
10270-
let description = if comment then '// "<%comment%>"'
10270+
let description = if comment then '/* <%comment%> */'
1027110271
<<
1027210272
z[<%valueReference%>] = <%cref(name)%>; <%description%>
1027310273
>>

0 commit comments

Comments
 (0)