diff --git a/Compiler/SimCode.mo b/Compiler/SimCode.mo index 5316005c9a6..4eaca806f00 100644 --- a/Compiler/SimCode.mo +++ b/Compiler/SimCode.mo @@ -7547,6 +7547,27 @@ algorithm end matchcontinue; end printExpOptStrIfConst; +public function makeCrefRecordExp +"function: makeCrefRecordExp + Helper function to generate records." + input DAE.ComponentRef inCRefRecord; + input DAE.ExpVar inVar; + output DAE.Exp outExp; +algorithm + outExp := matchcontinue (inCRefRecord,inVar) + local + DAE.ComponentRef cr,cr1; + String name; + DAE.ExpType tp; + case (cr,DAE.COMPLEX_VAR(name=name,tp=tp)) + equation + cr1 = Exp.extendCref(cr,tp,name,{}); + outExp = Exp.makeCrefExp(cr1,tp); + then + outExp; + end matchcontinue; +end makeCrefRecordExp; + /*****************************************************************************/ /* */ /* END OF DIRTY SIMCODEGEN FUNCTIONS */ diff --git a/Compiler/SimCodeC.mo b/Compiler/SimCodeC.mo index 9d46ae989de..036c1963809 100644 --- a/Compiler/SimCodeC.mo +++ b/Compiler/SimCodeC.mo @@ -17750,6 +17750,7 @@ protected function fun_409 input Tpl.Text in_txt; input SimCode.Context in_i_context; input DAE.ComponentRef in_i_cr; + input DAE.ExpType in_i_t; input Tpl.Text in_i_varDecls; input Tpl.Text in_i_preExp; input DAE.Exp in_i_exp; @@ -17759,10 +17760,11 @@ protected function fun_409 output Tpl.Text out_i_preExp; algorithm (out_txt, out_i_varDecls, out_i_preExp) := - matchcontinue(in_txt, in_i_context, in_i_cr, in_i_varDecls, in_i_preExp, in_i_exp) + matchcontinue(in_txt, in_i_context, in_i_cr, in_i_t, in_i_varDecls, in_i_preExp, in_i_exp) local Tpl.Text txt; DAE.ComponentRef i_cr; + DAE.ExpType i_t; Tpl.Text i_varDecls; Tpl.Text i_preExp; DAE.Exp i_exp; @@ -17770,6 +17772,7 @@ algorithm case ( txt, (i_context as SimCode.FUNCTION_CONTEXT()), _, + _, i_varDecls, i_preExp, i_exp ) @@ -17782,13 +17785,14 @@ algorithm case ( txt, i_context, i_cr, + i_t, i_varDecls, i_preExp, _ ) local SimCode.Context i_context; equation - (txt, i_preExp, i_varDecls) = daeExpRecordCrefRhs(txt, i_cr, i_context, i_preExp, i_varDecls); + (txt, i_preExp, i_varDecls) = daeExpRecordCrefRhs(txt, i_t, i_cr, i_context, i_preExp, i_varDecls); then (txt, i_varDecls, i_preExp); end matchcontinue; end fun_409; @@ -17813,15 +17817,16 @@ algorithm Tpl.Text i_varDecls; case ( txt, - (i_exp as DAE.CREF(componentRef = (i_cr as DAE.CREF_IDENT(subscriptLst = {})), ty = DAE.ET_COMPLEX(complexClassType = ClassInf.RECORD(path = _)))), + (i_exp as DAE.CREF(componentRef = i_cr, ty = (i_t as DAE.ET_COMPLEX(complexClassType = ClassInf.RECORD(path = _))))), i_context, i_preExp, i_varDecls ) local + DAE.ExpType i_t; DAE.ComponentRef i_cr; DAE.Exp i_exp; equation - (txt, i_varDecls, i_preExp) = fun_409(txt, i_context, i_cr, i_varDecls, i_preExp, i_exp); + (txt, i_varDecls, i_preExp) = fun_409(txt, i_context, i_cr, i_t, i_varDecls, i_preExp, i_exp); then (txt, i_preExp, i_varDecls); case ( txt, @@ -18384,7 +18389,44 @@ algorithm end matchcontinue; end lm_420; -protected function fun_421 +protected function lm_421 + input Tpl.Text in_txt; + input list> in_items; + + output Tpl.Text out_txt; +algorithm + out_txt := + matchcontinue(in_txt, in_items) + local + Tpl.Text txt; + + case ( txt, + {} ) + then txt; + + case ( txt, + (i_dim as SOME(i_i)) :: rest ) + local + list> rest; + Integer i_i; + Option i_dim; + equation + txt = Tpl.writeStr(txt, intString(i_i)); + txt = Tpl.nextIter(txt); + txt = lm_421(txt, rest); + then txt; + + case ( txt, + _ :: rest ) + local + list> rest; + equation + txt = lm_421(txt, rest); + then txt; + end matchcontinue; +end lm_421; + +protected function fun_422 input Tpl.Text in_txt; input SimCode.Context in_i_context; input DAE.ComponentRef in_i_cref_componentRef; @@ -18442,6 +18484,41 @@ algorithm txt = Tpl.writeText(txt, i_tmpArr); then (txt, i_preExp, i_varDecls); + case ( txt, + SimCode.OTHER(), + i_cref_componentRef, + i_preExp, + i_dims, + i_varDecls, + i_aty ) + local + Tpl.Text i_dimsValuesStr; + Integer ret_3; + Tpl.Text i_dimsLenStr; + Tpl.Text txt_1; + Tpl.Text i_tmpArr; + equation + txt_1 = expTypeArray(emptyTxt, i_aty); + (i_tmpArr, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(txt_1), i_varDecls); + ret_3 = listLength(i_dims); + i_dimsLenStr = Tpl.writeStr(emptyTxt, intString(ret_3)); + i_dimsValuesStr = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); + i_dimsValuesStr = lm_421(i_dimsValuesStr, i_dims); + i_dimsValuesStr = Tpl.popIter(i_dimsValuesStr); + i_preExp = expTypeShort(i_preExp, i_aty); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("_array_create(&")); + i_preExp = Tpl.writeText(i_preExp, i_tmpArr); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(", &")); + i_preExp = arrayCrefCStr(i_preExp, i_cref_componentRef); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(", ")); + i_preExp = Tpl.writeText(i_preExp, i_dimsLenStr); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(", ")); + i_preExp = Tpl.writeText(i_preExp, i_dimsValuesStr); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(");")); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_NEW_LINE()); + txt = Tpl.writeText(txt, i_tmpArr); + then (txt, i_preExp, i_varDecls); + case ( txt, _, _, @@ -18451,7 +18528,7 @@ algorithm _ ) then (txt, i_preExp, i_varDecls); end matchcontinue; -end fun_421; +end fun_422; public function daeExpCrefRhsArrayBox input Tpl.Text in_txt; @@ -18483,7 +18560,7 @@ algorithm DAE.ExpType i_aty; DAE.Exp i_cref; equation - (txt, i_preExp, i_varDecls) = fun_421(txt, i_context, i_cref_componentRef, i_preExp, i_dims, i_varDecls, i_aty); + (txt, i_preExp, i_varDecls) = fun_422(txt, i_context, i_cref_componentRef, i_preExp, i_dims, i_varDecls, i_aty); then (txt, i_preExp, i_varDecls); case ( txt, @@ -18495,51 +18572,71 @@ algorithm end matchcontinue; end daeExpCrefRhsArrayBox; -protected function lm_423 +protected function lm_424 input Tpl.Text in_txt; input list in_items; - input Tpl.Text in_i_record__name; + input Tpl.Text in_i_varDecls; + input Tpl.Text in_i_preExp; + input SimCode.Context in_i_context; + input DAE.ComponentRef in_i_cr; output Tpl.Text out_txt; - output Tpl.Text out_i_record__name; + output Tpl.Text out_i_varDecls; + output Tpl.Text out_i_preExp; algorithm - (out_txt, out_i_record__name) := - matchcontinue(in_txt, in_items, in_i_record__name) + (out_txt, out_i_varDecls, out_i_preExp) := + matchcontinue(in_txt, in_items, in_i_varDecls, in_i_preExp, in_i_context, in_i_cr) local Tpl.Text txt; - Tpl.Text i_record__name; + Tpl.Text i_varDecls; + Tpl.Text i_preExp; + SimCode.Context i_context; + DAE.ComponentRef i_cr; case ( txt, {}, - i_record__name ) - then (txt, i_record__name); + i_varDecls, + i_preExp, + _, + _ ) + then (txt, i_varDecls, i_preExp); case ( txt, i_v :: rest, - i_record__name ) + i_varDecls, + i_preExp, + i_context, + i_cr ) local list rest; DAE.ExpVar i_v; + DAE.Exp ret_0; equation - (txt, i_record__name) = daeExpRecordMemberCref(txt, i_v, i_record__name); + ret_0 = SimCode.makeCrefRecordExp(i_cr, i_v); + (txt, i_preExp, i_varDecls) = daeExp(txt, ret_0, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_record__name) = lm_423(txt, rest, i_record__name); - then (txt, i_record__name); + (txt, i_varDecls, i_preExp) = lm_424(txt, rest, i_varDecls, i_preExp, i_context, i_cr); + then (txt, i_varDecls, i_preExp); case ( txt, _ :: rest, - i_record__name ) + i_varDecls, + i_preExp, + i_context, + i_cr ) local list rest; equation - (txt, i_record__name) = lm_423(txt, rest, i_record__name); - then (txt, i_record__name); + (txt, i_varDecls, i_preExp) = lm_424(txt, rest, i_varDecls, i_preExp, i_context, i_cr); + then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_423; +end lm_424; -protected function fun_424 +public function daeExpRecordCrefRhs input Tpl.Text in_txt; + input DAE.ExpType in_i_ty; input DAE.ComponentRef in_i_cr; + input SimCode.Context in_i_context; input Tpl.Text in_i_preExp; input Tpl.Text in_i_varDecls; @@ -18548,34 +18645,35 @@ protected function fun_424 output Tpl.Text out_i_varDecls; algorithm (out_txt, out_i_preExp, out_i_varDecls) := - matchcontinue(in_txt, in_i_cr, in_i_preExp, in_i_varDecls) + matchcontinue(in_txt, in_i_ty, in_i_cr, in_i_context, in_i_preExp, in_i_varDecls) local Tpl.Text txt; + DAE.ComponentRef i_cr; + SimCode.Context i_context; Tpl.Text i_preExp; Tpl.Text i_varDecls; case ( txt, - (i_cr as DAE.CREF_IDENT(identType = DAE.ET_COMPLEX(name = i_record__path, varLst = i_var__lst))), + DAE.ET_COMPLEX(name = i_record__path, varLst = i_var__lst), + i_cr, + i_context, i_preExp, i_varDecls ) local list i_var__lst; Absyn.Path i_record__path; - DAE.ComponentRef i_cr; - Tpl.Text i_vars; Tpl.Text i_ret__var; Tpl.Text i_ret__type; Tpl.Text i_record__type__name; - Tpl.Text i_record__name; + Tpl.Text i_vars; equation - i_record__name = cref(emptyTxt, i_cr); + i_vars = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); + (i_vars, i_varDecls, i_preExp) = lm_424(i_vars, i_var__lst, i_varDecls, i_preExp, i_context, i_cr); + i_vars = Tpl.popIter(i_vars); i_record__type__name = underscorePath(emptyTxt, i_record__path); i_ret__type = Tpl.writeText(emptyTxt, i_record__type__name); i_ret__type = Tpl.writeTok(i_ret__type, Tpl.ST_STRING("_rettype")); (i_ret__var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_ret__type), i_varDecls); - i_vars = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_vars, i_record__name) = lm_423(i_vars, i_var__lst, i_record__name); - i_vars = Tpl.popIter(i_vars); i_preExp = Tpl.writeText(i_preExp, i_ret__var); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(" = _")); i_preExp = Tpl.writeText(i_preExp, i_record__type__name); @@ -18590,71 +18688,16 @@ algorithm then (txt, i_preExp, i_varDecls); case ( txt, + _, + _, _, i_preExp, i_varDecls ) then (txt, i_preExp, i_varDecls); end matchcontinue; -end fun_424; - -public function daeExpRecordCrefRhs - input Tpl.Text txt; - input DAE.ComponentRef i_cr; - input SimCode.Context i_context; - input Tpl.Text i_preExp; - input Tpl.Text i_varDecls; - - output Tpl.Text out_txt; - output Tpl.Text out_i_preExp; - output Tpl.Text out_i_varDecls; -algorithm - (out_txt, out_i_preExp, out_i_varDecls) := fun_424(txt, i_cr, i_preExp, i_varDecls); end daeExpRecordCrefRhs; protected function fun_426 - input Tpl.Text in_txt; - input DAE.ExpVar in_i_var; - input Tpl.Text in_i_recordName; - - output Tpl.Text out_txt; -algorithm - out_txt := - matchcontinue(in_txt, in_i_var, in_i_recordName) - local - Tpl.Text txt; - Tpl.Text i_recordName; - - case ( txt, - DAE.COMPLEX_VAR(name = i_var__name), - i_recordName ) - local - String i_var__name; - equation - txt = Tpl.writeText(txt, i_recordName); - txt = Tpl.writeTok(txt, Tpl.ST_STRING("$P")); - txt = Tpl.writeStr(txt, i_var__name); - then txt; - - case ( txt, - _, - _ ) - then txt; - end matchcontinue; -end fun_426; - -public function daeExpRecordMemberCref - input Tpl.Text txt; - input DAE.ExpVar i_var; - input Tpl.Text i_recordName; - - output Tpl.Text out_txt; - output Tpl.Text out_i_recordName; -algorithm - out_txt := fun_426(txt, i_var, i_recordName); - out_i_recordName := i_recordName; -end daeExpRecordMemberCref; - -protected function fun_428 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18677,9 +18720,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_428; +end fun_426; -protected function fun_429 +protected function fun_427 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18702,9 +18745,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_429; +end fun_427; -protected function fun_430 +protected function fun_428 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18727,9 +18770,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_430; +end fun_428; -protected function fun_431 +protected function fun_429 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18752,9 +18795,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_431; +end fun_429; -protected function fun_432 +protected function fun_430 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18777,9 +18820,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_scalar")); then txt; end matchcontinue; -end fun_432; +end fun_430; -protected function fun_433 +protected function fun_431 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18802,9 +18845,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real")); then txt; end matchcontinue; -end fun_433; +end fun_431; -protected function fun_434 +protected function fun_432 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -18827,9 +18870,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_434; +end fun_432; -protected function fun_435 +protected function fun_433 input Tpl.Text in_txt; input DAE.Operator in_i_operator; input SimCode.Context in_i_context; @@ -18982,7 +19025,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_428(emptyTxt, i_ty); + i_type = fun_426(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("add_alloc_")); i_preExp = Tpl.writeText(i_preExp, i_type); @@ -19010,7 +19053,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_429(emptyTxt, i_ty); + i_type = fun_427(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("sub_alloc_")); i_preExp = Tpl.writeText(i_preExp, i_type); @@ -19062,7 +19105,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_430(emptyTxt, i_ty); + i_type = fun_428(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("mul_alloc_scalar_")); i_preExp = Tpl.writeText(i_preExp, i_type); @@ -19090,7 +19133,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_431(emptyTxt, i_ty); + i_type = fun_429(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("mul_alloc_")); i_preExp = Tpl.writeText(i_preExp, i_type); @@ -19165,7 +19208,7 @@ algorithm DAE.ExpType i_ty; Tpl.Text i_type; equation - i_type = fun_432(emptyTxt, i_ty); + i_type = fun_430(emptyTxt, i_ty); txt = Tpl.writeTok(txt, Tpl.ST_STRING("mul_")); txt = Tpl.writeText(txt, i_type); txt = Tpl.writeTok(txt, Tpl.ST_STRING("_product(&")); @@ -19189,7 +19232,7 @@ algorithm Tpl.Text i_type; Tpl.Text i_typeShort; equation - i_typeShort = fun_433(emptyTxt, i_ty); + i_typeShort = fun_431(emptyTxt, i_ty); i_type = Tpl.writeText(emptyTxt, i_typeShort); i_type = Tpl.writeTok(i_type, Tpl.ST_STRING("_array")); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); @@ -19219,7 +19262,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_434(emptyTxt, i_ty); + i_type = fun_432(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("div_alloc_")); i_preExp = Tpl.writeText(i_preExp, i_type); @@ -19306,7 +19349,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR")); then (txt, i_preExp, i_varDecls); end matchcontinue; -end fun_435; +end fun_433; public function daeExpBinary input Tpl.Text in_txt; @@ -19342,7 +19385,7 @@ algorithm equation (i_e1, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp1, i_context, i_preExp, i_varDecls); (i_e2, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp2, i_context, i_preExp, i_varDecls); - (txt, i_preExp, i_varDecls) = fun_435(txt, i_operator, i_context, i_exp, i_e2, i_e1, i_preExp, i_varDecls); + (txt, i_preExp, i_varDecls) = fun_433(txt, i_operator, i_context, i_exp, i_e2, i_e1, i_preExp, i_varDecls); then (txt, i_preExp, i_varDecls); case ( txt, @@ -19354,7 +19397,7 @@ algorithm end matchcontinue; end daeExpBinary; -protected function fun_437 +protected function fun_435 input Tpl.Text in_txt; input DAE.Operator in_i_operator; input Tpl.Text in_i_preExp; @@ -19426,7 +19469,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("daeExpUnary:ERR")); then (txt, i_preExp); end matchcontinue; -end fun_437; +end fun_435; public function daeExpUnary input Tpl.Text in_txt; @@ -19458,7 +19501,7 @@ algorithm Tpl.Text i_e; equation (i_e, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp, i_context, i_preExp, i_varDecls); - (txt, i_preExp) = fun_437(txt, i_operator, i_preExp, i_e); + (txt, i_preExp) = fun_435(txt, i_operator, i_preExp, i_e); then (txt, i_preExp, i_varDecls); case ( txt, @@ -19470,7 +19513,7 @@ algorithm end matchcontinue; end daeExpUnary; -protected function fun_439 +protected function fun_437 input Tpl.Text in_txt; input DAE.Operator in_i_operator; input Tpl.Text in_i_e2; @@ -19517,7 +19560,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("daeExpLbinary:ERR")); then txt; end matchcontinue; -end fun_439; +end fun_437; public function daeExpLbinary input Tpl.Text in_txt; @@ -19552,7 +19595,7 @@ algorithm equation (i_e1, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp1, i_context, i_preExp, i_varDecls); (i_e2, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp2, i_context, i_preExp, i_varDecls); - txt = fun_439(txt, i_operator, i_e2, i_e1); + txt = fun_437(txt, i_operator, i_e2, i_e1); then (txt, i_preExp, i_varDecls); case ( txt, @@ -19564,7 +19607,7 @@ algorithm end matchcontinue; end daeExpLbinary; -protected function fun_441 +protected function fun_439 input Tpl.Text in_txt; input DAE.Operator in_i_operator; input Tpl.Text in_i_e; @@ -19591,7 +19634,7 @@ algorithm _ ) then txt; end matchcontinue; -end fun_441; +end fun_439; public function daeExpLunary input Tpl.Text in_txt; @@ -19623,7 +19666,7 @@ algorithm Tpl.Text i_e; equation (i_e, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp, i_context, i_preExp, i_varDecls); - txt = fun_441(txt, i_operator, i_e); + txt = fun_439(txt, i_operator, i_e); then (txt, i_preExp, i_varDecls); case ( txt, @@ -19635,7 +19678,7 @@ algorithm end matchcontinue; end daeExpLunary; -protected function fun_443 +protected function fun_441 input Tpl.Text in_txt; input DAE.Operator in_i_rel_operator; input Tpl.Text in_i_e2; @@ -19938,9 +19981,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("daeExpRelation:ERR")); then txt; end matchcontinue; -end fun_443; +end fun_441; -protected function fun_444 +protected function fun_442 input Tpl.Text in_txt; input String in_it; input Tpl.Text in_i_simRel; @@ -19982,7 +20025,7 @@ algorithm equation (i_e1, i_preExp, i_varDecls) = daeExp(emptyTxt, i_rel_exp1, i_context, i_preExp, i_varDecls); (i_e2, i_preExp, i_varDecls) = daeExp(emptyTxt, i_rel_exp2, i_context, i_preExp, i_varDecls); - txt = fun_443(txt, i_rel_operator, i_e2, i_e1); + txt = fun_441(txt, i_rel_operator, i_e2, i_e1); then (txt, i_varDecls, i_preExp); case ( txt, @@ -19998,7 +20041,7 @@ algorithm txt = Tpl.writeText(txt, i_simRel); then (txt, i_varDecls, i_preExp); end matchcontinue; -end fun_444; +end fun_442; public function daeExpRelation input Tpl.Text in_txt; @@ -20034,7 +20077,7 @@ algorithm equation (i_simRel, i_preExp, i_varDecls) = daeExpRelationSim(emptyTxt, i_rel, i_context, i_preExp, i_varDecls); str_1 = Tpl.textString(i_simRel); - (txt, i_varDecls, i_preExp) = fun_444(txt, str_1, i_simRel, i_rel_operator, i_rel_exp2, i_varDecls, i_preExp, i_context, i_rel_exp1); + (txt, i_varDecls, i_preExp) = fun_442(txt, str_1, i_simRel, i_rel_operator, i_rel_exp2, i_varDecls, i_preExp, i_context, i_rel_exp1); then (txt, i_preExp, i_varDecls); case ( txt, @@ -20046,7 +20089,7 @@ algorithm end matchcontinue; end daeExpRelation; -protected function fun_446 +protected function fun_444 input Tpl.Text in_txt; input DAE.Operator in_i_rel_operator; input Tpl.Text in_i_e2; @@ -20146,9 +20189,9 @@ algorithm i_preExp ) then (txt, i_preExp); end matchcontinue; -end fun_446; +end fun_444; -protected function fun_447 +protected function fun_445 input Tpl.Text in_txt; input SimCode.Context in_i_context; input DAE.Operator in_i_rel_operator; @@ -20187,7 +20230,7 @@ algorithm (i_e1, i_preExp, i_varDecls) = daeExp(emptyTxt, i_rel_exp1, i_context, i_preExp, i_varDecls); (i_e2, i_preExp, i_varDecls) = daeExp(emptyTxt, i_rel_exp2, i_context, i_preExp, i_varDecls); (i_res, i_varDecls) = tempDecl(emptyTxt, "modelica_boolean", i_varDecls); - (txt, i_preExp) = fun_446(txt, i_rel_operator, i_e2, i_e1, i_res, i_preExp); + (txt, i_preExp) = fun_444(txt, i_rel_operator, i_e2, i_e1, i_res, i_preExp); then (txt, i_varDecls, i_preExp); case ( txt, @@ -20199,7 +20242,7 @@ algorithm _ ) then (txt, i_varDecls, i_preExp); end matchcontinue; -end fun_447; +end fun_445; public function daeExpRelationSim input Tpl.Text in_txt; @@ -20231,7 +20274,7 @@ algorithm DAE.Exp i_rel_exp1; DAE.Exp i_rel; equation - (txt, i_varDecls, i_preExp) = fun_447(txt, i_context, i_rel_operator, i_rel_exp2, i_varDecls, i_preExp, i_rel_exp1); + (txt, i_varDecls, i_preExp) = fun_445(txt, i_context, i_rel_operator, i_rel_exp2, i_varDecls, i_preExp, i_rel_exp1); then (txt, i_preExp, i_varDecls); case ( txt, @@ -20328,7 +20371,7 @@ algorithm end matchcontinue; end daeExpIf; -protected function fun_450 +protected function fun_448 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -20351,9 +20394,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("real_array")); then txt; end matchcontinue; -end fun_450; +end fun_448; -protected function fun_451 +protected function fun_449 input Tpl.Text in_txt; input DAE.ExpType in_i_arg_ty; @@ -20374,9 +20417,9 @@ algorithm _ ) then txt; end matchcontinue; -end fun_451; +end fun_449; -protected function lm_452 +protected function lm_450 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -20413,7 +20456,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExp(txt, i_exp, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_452(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_450(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -20424,12 +20467,12 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_452(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_450(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_452; +end lm_450; -protected function lm_453 +protected function lm_451 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -20466,7 +20509,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExp(txt, i_exp, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_453(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_451(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -20477,12 +20520,12 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_453(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_451(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_453; +end lm_451; -protected function fun_454 +protected function fun_452 input Tpl.Text in_txt; input Boolean in_i_builtin; input Tpl.Text in_i_retType; @@ -20516,9 +20559,9 @@ algorithm txt = Tpl.writeText(txt, i_retVar); then txt; end matchcontinue; -end fun_454; +end fun_452; -protected function lm_455 +protected function lm_453 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -20555,7 +20598,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExp(txt, i_exp, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_455(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_453(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -20566,10 +20609,10 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_455(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_453(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_455; +end lm_453; public function daeExpCall input Tpl.Text in_txt; @@ -20634,7 +20677,7 @@ algorithm Tpl.Text i_var; Tpl.Text i_type; equation - i_type = fun_450(emptyTxt, i_ty); + i_type = fun_448(emptyTxt, i_ty); (i_var, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_type), i_varDecls); (i_var1, i_preExp, i_varDecls) = daeExp(emptyTxt, i_e1, i_context, i_preExp, i_varDecls); (i_var2, i_preExp, i_varDecls) = daeExp(emptyTxt, i_e2, i_context, i_preExp, i_varDecls); @@ -20683,7 +20726,7 @@ algorithm equation i_retType = expTypeArrayIf(emptyTxt, i_arg_ty); (i_retVar, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_retType), i_varDecls); - i_cast = fun_451(emptyTxt, i_arg_ty); + i_cast = fun_449(emptyTxt, i_arg_ty); i_preExp = Tpl.writeText(i_preExp, i_retVar); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(" = ")); i_preExp = Tpl.writeText(i_preExp, i_cast); @@ -21018,7 +21061,7 @@ algorithm Tpl.Text i_argStr; equation i_argStr = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_argStr, i_varDecls, i_preExp) = lm_452(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); + (i_argStr, i_varDecls, i_preExp) = lm_450(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); i_argStr = Tpl.popIter(i_argStr); i_funName = underscorePath(emptyTxt, i_path); i_preExp = daeExpCallBuiltinPrefix(i_preExp, i_builtin); @@ -21045,7 +21088,7 @@ algorithm Tpl.Text i_argStr; equation i_argStr = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_argStr, i_varDecls, i_preExp) = lm_453(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); + (i_argStr, i_varDecls, i_preExp) = lm_451(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); i_argStr = Tpl.popIter(i_argStr); i_funName = underscorePath(emptyTxt, i_path); i_retType = Tpl.writeText(emptyTxt, i_funName); @@ -21059,7 +21102,7 @@ algorithm i_preExp = Tpl.writeText(i_preExp, i_argStr); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(");")); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_NEW_LINE()); - txt = fun_454(txt, i_builtin, i_retType, i_retVar); + txt = fun_452(txt, i_builtin, i_retType, i_retVar); then (txt, i_preExp, i_varDecls); case ( txt, @@ -21077,7 +21120,7 @@ algorithm Tpl.Text i_argStr; equation i_argStr = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_argStr, i_varDecls, i_preExp) = lm_455(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); + (i_argStr, i_varDecls, i_preExp) = lm_453(i_argStr, i_expLst, i_varDecls, i_preExp, i_context); i_argStr = Tpl.popIter(i_argStr); i_funName = underscorePath(emptyTxt, i_path); i_retType = Tpl.writeText(emptyTxt, i_funName); @@ -21130,7 +21173,7 @@ algorithm end matchcontinue; end daeExpCallBuiltinPrefix; -protected function fun_458 +protected function fun_456 input Tpl.Text in_txt; input Boolean in_i_scalar; @@ -21151,9 +21194,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("scalar_")); then txt; end matchcontinue; -end fun_458; +end fun_456; -protected function fun_459 +protected function fun_457 input Tpl.Text in_txt; input Boolean in_i_scalar; @@ -21174,9 +21217,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("&")); then txt; end matchcontinue; -end fun_459; +end fun_457; -protected function fun_460 +protected function fun_458 input Tpl.Text in_txt; input Boolean in_i_scalar; input DAE.Exp in_i_e; @@ -21205,9 +21248,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING(")")); then txt; end matchcontinue; -end fun_460; +end fun_458; -protected function lm_461 +protected function lm_459 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -21247,11 +21290,11 @@ algorithm DAE.Exp i_e; Tpl.Text i_prefix; equation - i_prefix = fun_460(emptyTxt, i_scalar, i_e); + i_prefix = fun_458(emptyTxt, i_scalar, i_e); txt = Tpl.writeText(txt, i_prefix); (txt, i_preExp, i_varDecls) = daeExp(txt, i_e, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_461(txt, rest, i_varDecls, i_preExp, i_context, i_scalar); + (txt, i_varDecls, i_preExp) = lm_459(txt, rest, i_varDecls, i_preExp, i_context, i_scalar); then (txt, i_varDecls, i_preExp); case ( txt, @@ -21263,10 +21306,10 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_461(txt, rest, i_varDecls, i_preExp, i_context, i_scalar); + (txt, i_varDecls, i_preExp) = lm_459(txt, rest, i_varDecls, i_preExp, i_context, i_scalar); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_461; +end lm_459; public function daeExpArray input Tpl.Text in_txt; @@ -21305,10 +21348,10 @@ algorithm equation i_arrayTypeStr = expTypeArray(emptyTxt, i_ty); (i_arrayVar, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(i_arrayTypeStr), i_varDecls); - i_scalarPrefix = fun_458(emptyTxt, i_scalar); - i_scalarRef = fun_459(emptyTxt, i_scalar); + i_scalarPrefix = fun_456(emptyTxt, i_scalar); + i_scalarRef = fun_457(emptyTxt, i_scalar); i_params = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_params, i_varDecls, i_preExp) = lm_461(i_params, i_array, i_varDecls, i_preExp, i_context, i_scalar); + (i_params, i_varDecls, i_preExp) = lm_459(i_params, i_array, i_varDecls, i_preExp, i_context, i_scalar); i_params = Tpl.popIter(i_params); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("array_alloc_")); i_preExp = Tpl.writeText(i_preExp, i_scalarPrefix); @@ -21334,7 +21377,7 @@ algorithm end matchcontinue; end daeExpArray; -protected function lm_463 +protected function lm_461 input Tpl.Text in_txt; input list>> in_items; input Tpl.Text in_i_vars2; @@ -21395,7 +21438,7 @@ algorithm txt = Tpl.writeText(txt, i_vars); txt = Tpl.writeTok(txt, Tpl.ST_STRING(");")); txt = Tpl.nextIter(txt); - (txt, i_vars2, i_promote, i_varDecls) = lm_463(txt, rest, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); + (txt, i_vars2, i_promote, i_varDecls) = lm_461(txt, rest, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); then (txt, i_vars2, i_promote, i_varDecls); case ( txt, @@ -21408,10 +21451,10 @@ algorithm local list>> rest; equation - (txt, i_vars2, i_promote, i_varDecls) = lm_463(txt, rest, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); + (txt, i_vars2, i_promote, i_varDecls) = lm_461(txt, rest, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); then (txt, i_vars2, i_promote, i_varDecls); end matchcontinue; -end lm_463; +end lm_461; public function daeExpMatrix input Tpl.Text in_txt; @@ -21494,7 +21537,7 @@ algorithm i_vars2 = emptyTxt; i_promote = emptyTxt; i_catAlloc = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_catAlloc, i_vars2, i_promote, i_varDecls) = lm_463(i_catAlloc, i_m_scalar, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); + (i_catAlloc, i_vars2, i_promote, i_varDecls) = lm_461(i_catAlloc, i_m_scalar, i_vars2, i_promote, i_context, i_varDecls, i_arrayTypeStr); i_catAlloc = Tpl.popIter(i_catAlloc); i_preExp = Tpl.writeText(i_preExp, i_promote); i_preExp = Tpl.writeText(i_preExp, i_catAlloc); @@ -21522,7 +21565,7 @@ algorithm end matchcontinue; end daeExpMatrix; -protected function fun_465 +protected function fun_463 input Tpl.Text in_txt; input Boolean in_i_b; @@ -21543,9 +21586,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("scalar_")); then txt; end matchcontinue; -end fun_465; +end fun_463; -protected function fun_466 +protected function fun_464 input Tpl.Text in_txt; input Boolean in_i_b; @@ -21566,9 +21609,9 @@ algorithm _ ) then txt; end matchcontinue; -end fun_466; +end fun_464; -protected function lm_467 +protected function lm_465 input Tpl.Text in_txt; input list> in_items; input Tpl.Text in_i_varLstStr; @@ -21618,8 +21661,8 @@ algorithm Tpl.Text i_scalarRefStr; Tpl.Text i_scalarStr; equation - i_scalarStr = fun_465(emptyTxt, i_b); - i_scalarRefStr = fun_466(emptyTxt, i_b); + i_scalarStr = fun_463(emptyTxt, i_b); + i_scalarRefStr = fun_464(emptyTxt, i_b); (i_expVar, i_preExp, i_varDecls) = daeExp(emptyTxt, i_e, i_context, i_preExp, i_varDecls); (i_tmp, i_varDecls) = tempDecl(emptyTxt, i_arrayTypeStr, i_varDecls); i_varLstStr = Tpl.writeTok(i_varLstStr, Tpl.ST_STRING(", &")); @@ -21634,7 +21677,7 @@ algorithm txt = Tpl.writeText(txt, i_tmp); txt = Tpl.writeTok(txt, Tpl.ST_STRING(");")); txt = Tpl.nextIter(txt); - (txt, i_varLstStr, i_varDecls, i_preExp) = lm_467(txt, rest, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); + (txt, i_varLstStr, i_varDecls, i_preExp) = lm_465(txt, rest, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); then (txt, i_varLstStr, i_varDecls, i_preExp); case ( txt, @@ -21647,10 +21690,10 @@ algorithm local list> rest; equation - (txt, i_varLstStr, i_varDecls, i_preExp) = lm_467(txt, rest, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); + (txt, i_varLstStr, i_varDecls, i_preExp) = lm_465(txt, rest, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); then (txt, i_varLstStr, i_varDecls, i_preExp); end matchcontinue; -end lm_467; +end lm_465; public function daeExpMatrixRow input Tpl.Text txt; @@ -21669,14 +21712,14 @@ protected algorithm i_varLstStr := emptyTxt; i_preExp2 := Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_preExp2, i_varLstStr, out_i_varDecls, out_i_preExp) := lm_467(i_preExp2, i_row, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); + (i_preExp2, i_varLstStr, out_i_varDecls, out_i_preExp) := lm_465(i_preExp2, i_row, i_varLstStr, i_arrayTypeStr, i_varDecls, i_preExp, i_context); i_preExp2 := Tpl.popIter(i_preExp2); i_preExp2 := Tpl.writeTok(i_preExp2, Tpl.ST_NEW_LINE()); out_i_preExp := Tpl.writeText(out_i_preExp, i_preExp2); out_txt := Tpl.writeText(txt, i_varLstStr); end daeExpMatrixRow; -protected function fun_469 +protected function fun_467 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; input Tpl.Text in_i_preExp; @@ -21759,7 +21802,7 @@ algorithm _ ) then (txt, i_preExp, i_varDecls); end matchcontinue; -end fun_469; +end fun_467; public function daeExpCast input Tpl.Text in_txt; @@ -21791,7 +21834,7 @@ algorithm Tpl.Text i_expVar; equation (i_expVar, i_preExp, i_varDecls) = daeExp(emptyTxt, i_exp, i_context, i_preExp, i_varDecls); - (txt, i_preExp, i_varDecls) = fun_469(txt, i_ty, i_preExp, i_exp, i_varDecls, i_expVar); + (txt, i_preExp, i_varDecls) = fun_467(txt, i_ty, i_preExp, i_exp, i_varDecls, i_expVar); then (txt, i_preExp, i_varDecls); case ( txt, @@ -21803,7 +21846,7 @@ algorithm end matchcontinue; end daeExpCast; -protected function fun_471 +protected function fun_469 input Tpl.Text in_txt; input SimCode.Context in_i_context; input Tpl.Text in_i_varDecls; @@ -21850,7 +21893,7 @@ algorithm txt = Tpl.writeText(txt, i_arrName); then (txt, i_varDecls, i_preExp); end matchcontinue; -end fun_471; +end fun_469; public function daeExpAsub input Tpl.Text in_txt; @@ -21999,7 +22042,7 @@ algorithm equation ret_1 = SimCode.buildCrefExpFromAsub(i_cref, i_subs); (i_arrName, i_preExp, i_varDecls) = daeExpCrefRhs(emptyTxt, ret_1, i_context, i_preExp, i_varDecls); - (txt, i_varDecls, i_preExp) = fun_471(txt, i_context, i_varDecls, i_preExp, i_arrName, i_subs, i_cref_ty); + (txt, i_varDecls, i_preExp) = fun_469(txt, i_context, i_varDecls, i_preExp, i_arrName, i_subs, i_cref_ty); then (txt, i_preExp, i_varDecls); case ( txt, @@ -22073,7 +22116,7 @@ algorithm end matchcontinue; end daeExpSize; -protected function fun_474 +protected function fun_472 input Tpl.Text in_txt; input String in_it; @@ -22100,7 +22143,7 @@ algorithm _ ) then txt; end matchcontinue; -end fun_474; +end fun_472; public function daeExpReduction input Tpl.Text in_txt; @@ -22147,7 +22190,7 @@ algorithm i_tmpExpPre = emptyTxt; (i_tmpExpVar, i_tmpExpPre, i_varDecls) = daeExp(emptyTxt, i_expr, i_context, i_tmpExpPre, i_varDecls); str_7 = Tpl.textString(i_accFun); - i_cast = fun_474(emptyTxt, str_7); + i_cast = fun_472(emptyTxt, str_7); i_body = Tpl.writeText(emptyTxt, i_tmpExpPre); i_body = Tpl.softNewLine(i_body); i_body = Tpl.writeText(i_body, i_res); @@ -22242,7 +22285,7 @@ algorithm end matchcontinue; end daeExpReductionLoop; -protected function fun_477 +protected function fun_475 input Tpl.Text in_txt; input String in_i_type; @@ -22271,9 +22314,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("INVALID_TYPE")); then txt; end matchcontinue; -end fun_477; +end fun_475; -protected function fun_478 +protected function fun_476 input Tpl.Text in_txt; input String in_i_type; @@ -22302,7 +22345,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("INVALID_TYPE")); then txt; end matchcontinue; -end fun_478; +end fun_476; public function daeExpReductionFnName input Tpl.Text in_txt; @@ -22321,14 +22364,14 @@ algorithm "sum", i_type ) equation - txt = fun_477(txt, i_type); + txt = fun_475(txt, i_type); then txt; case ( txt, "product", i_type ) equation - txt = fun_478(txt, i_type); + txt = fun_476(txt, i_type); then txt; case ( txt, @@ -22342,7 +22385,7 @@ algorithm end matchcontinue; end daeExpReductionFnName; -protected function fun_480 +protected function fun_478 input Tpl.Text in_txt; input String in_i_type; @@ -22371,9 +22414,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("INVALID_TYPE")); then txt; end matchcontinue; -end fun_480; +end fun_478; -protected function fun_481 +protected function fun_479 input Tpl.Text in_txt; input String in_i_type; @@ -22402,7 +22445,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("INVALID_TYPE")); then txt; end matchcontinue; -end fun_481; +end fun_479; public function daeExpReductionStartValue input Tpl.Text in_txt; @@ -22421,14 +22464,14 @@ algorithm "min", i_type ) equation - txt = fun_480(txt, i_type); + txt = fun_478(txt, i_type); then txt; case ( txt, "max", i_type ) equation - txt = fun_481(txt, i_type); + txt = fun_479(txt, i_type); then txt; case ( txt, @@ -22454,7 +22497,7 @@ algorithm end matchcontinue; end daeExpReductionStartValue; -protected function lm_483 +protected function lm_481 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_preExpInner; @@ -22486,7 +22529,7 @@ algorithm SimCode.Variable i_var; equation (txt, i_varDeclsInner, i_preExpInner) = varInit(txt, i_var, "", 0, i_varDeclsInner, i_preExpInner); - (txt, i_preExpInner, i_varDeclsInner) = lm_483(txt, rest, i_preExpInner, i_varDeclsInner); + (txt, i_preExpInner, i_varDeclsInner) = lm_481(txt, rest, i_preExpInner, i_varDeclsInner); then (txt, i_preExpInner, i_varDeclsInner); case ( txt, @@ -22496,12 +22539,12 @@ algorithm local list rest; equation - (txt, i_preExpInner, i_varDeclsInner) = lm_483(txt, rest, i_preExpInner, i_varDeclsInner); + (txt, i_preExpInner, i_varDeclsInner) = lm_481(txt, rest, i_preExpInner, i_varDeclsInner); then (txt, i_preExpInner, i_varDeclsInner); end matchcontinue; -end lm_483; +end lm_481; -protected function lm_484 +protected function lm_482 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDeclsInner; @@ -22533,7 +22576,7 @@ algorithm equation (txt, i_varDeclsInner) = algStatement(txt, i_stmt, i_context, i_varDeclsInner); txt = Tpl.nextIter(txt); - (txt, i_varDeclsInner) = lm_484(txt, rest, i_varDeclsInner, i_context); + (txt, i_varDeclsInner) = lm_482(txt, rest, i_varDeclsInner, i_context); then (txt, i_varDeclsInner); case ( txt, @@ -22543,12 +22586,12 @@ algorithm local list rest; equation - (txt, i_varDeclsInner) = lm_484(txt, rest, i_varDeclsInner, i_context); + (txt, i_varDeclsInner) = lm_482(txt, rest, i_varDeclsInner, i_context); then (txt, i_varDeclsInner); end matchcontinue; -end lm_484; +end lm_482; -protected function fun_485 +protected function fun_483 input Tpl.Text in_txt; input DAE.Exp in_i_exp; input SimCode.Context in_i_context; @@ -22588,12 +22631,12 @@ algorithm i_preExpRes = emptyTxt; i_varDeclsInner = emptyTxt; ret_4 = SimCode.valueblockVars(i_exp); - (i_0__, i_preExpInner, i_varDeclsInner) = lm_483(emptyTxt, ret_4, i_preExpInner, i_varDeclsInner); + (i_0__, i_preExpInner, i_varDeclsInner) = lm_481(emptyTxt, ret_4, i_preExpInner, i_varDeclsInner); i_resType = expTypeModelica(emptyTxt, i_ty); txt_7 = expTypeModelica(emptyTxt, i_ty); (i_res, i_preExp) = tempDecl(emptyTxt, Tpl.textString(txt_7), i_preExp); i_stmts = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_stmts, i_varDeclsInner) = lm_484(i_stmts, i_body, i_varDeclsInner, i_context); + (i_stmts, i_varDeclsInner) = lm_482(i_stmts, i_body, i_varDeclsInner, i_context); i_stmts = Tpl.popIter(i_stmts); (i_expPart, i_preExpRes, i_varDeclsInner) = daeExp(emptyTxt, i_result, i_context, i_preExpRes, i_varDeclsInner); i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_LINE("{\n")); @@ -22621,7 +22664,7 @@ algorithm i_preExp ) then (txt, i_preExp); end matchcontinue; -end fun_485; +end fun_483; public function daeExpValueblock input Tpl.Text txt; @@ -22634,11 +22677,11 @@ public function daeExpValueblock output Tpl.Text out_i_preExp; output Tpl.Text out_i_varDecls; algorithm - (out_txt, out_i_preExp) := fun_485(txt, i_exp, i_context, i_preExp); + (out_txt, out_i_preExp) := fun_483(txt, i_exp, i_context, i_preExp); out_i_varDecls := i_varDecls; end daeExpValueblock; -protected function lm_487 +protected function lm_485 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -22675,7 +22718,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExp(txt, i_exp, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_487(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_485(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -22686,10 +22729,10 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_487(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_485(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_487; +end lm_485; public function arrayScalarRhs input Tpl.Text txt; @@ -22713,7 +22756,7 @@ algorithm ret_2 := listLength(i_subs); i_dimsLenStr := Tpl.writeStr(emptyTxt, intString(ret_2)); i_dimsValuesStr := Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_dimsValuesStr, out_i_varDecls, out_i_preExp) := lm_487(i_dimsValuesStr, i_subs, i_varDecls, i_preExp, i_context); + (i_dimsValuesStr, out_i_varDecls, out_i_preExp) := lm_485(i_dimsValuesStr, i_subs, i_varDecls, i_preExp, i_context); i_dimsValuesStr := Tpl.popIter(i_dimsValuesStr); out_txt := Tpl.writeTok(txt, Tpl.ST_STRING("(*")); out_txt := Tpl.writeText(out_txt, i_arrayType); @@ -22884,7 +22927,7 @@ algorithm end matchcontinue; end daeExpCons; -protected function lm_492 +protected function lm_490 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -22921,7 +22964,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExpMetaHelperConstant(txt, i_e, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_492(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_490(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -22932,10 +22975,10 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_492(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_490(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_492; +end lm_490; public function daeExpMetaTuple input Tpl.Text in_txt; @@ -22971,7 +23014,7 @@ algorithm ret_1 = listLength(i_listExp); i_start = daeExpMetaHelperBoxStart(emptyTxt, ret_1); i_args = Tpl.pushIter(emptyTxt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (i_args, i_varDecls, i_preExp) = lm_492(i_args, i_listExp, i_varDecls, i_preExp, i_context); + (i_args, i_varDecls, i_preExp) = lm_490(i_args, i_listExp, i_varDecls, i_preExp, i_context); i_args = Tpl.popIter(i_args); (i_tmp, i_varDecls) = tempDecl(emptyTxt, "modelica_metatype", i_varDecls); i_preExp = Tpl.writeText(i_preExp, i_tmp); @@ -23045,7 +23088,7 @@ algorithm end matchcontinue; end daeExpMetaOption; -protected function lm_495 +protected function lm_493 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -23082,7 +23125,7 @@ algorithm equation (txt, i_preExp, i_varDecls) = daeExpMetaHelperConstant(txt, i_exp, i_context, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_495(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_493(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); case ( txt, @@ -23093,12 +23136,12 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_495(txt, rest, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_493(txt, rest, i_varDecls, i_preExp, i_context); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_495; +end lm_493; -protected function fun_496 +protected function fun_494 input Tpl.Text in_txt; input list in_i_args; input Tpl.Text in_i_varDecls; @@ -23134,11 +23177,11 @@ algorithm equation txt = Tpl.writeTok(txt, Tpl.ST_STRING(", ")); txt = Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (txt, i_varDecls, i_preExp) = lm_495(txt, i_args, i_varDecls, i_preExp, i_context); + (txt, i_varDecls, i_preExp) = lm_493(txt, i_args, i_varDecls, i_preExp, i_context); txt = Tpl.popIter(txt); then (txt, i_varDecls, i_preExp); end matchcontinue; -end fun_496; +end fun_494; public function daeExpMetarecordcall input Tpl.Text in_txt; @@ -23178,7 +23221,7 @@ algorithm equation ret_1 = SimCode.incrementInt(i_index, 3); i_newIndex = Tpl.writeStr(emptyTxt, intString(ret_1)); - (i_argsStr, i_varDecls, i_preExp) = fun_496(emptyTxt, i_args, i_varDecls, i_preExp, i_context); + (i_argsStr, i_varDecls, i_preExp) = fun_494(emptyTxt, i_args, i_varDecls, i_preExp, i_context); i_box = Tpl.writeTok(emptyTxt, Tpl.ST_STRING("mmc_mk_box")); ret_4 = listLength(i_args); ret_5 = SimCode.incrementInt(ret_4, 1); @@ -23226,7 +23269,7 @@ algorithm (out_txt, i_expPart, out_i_preExp, out_i_varDecls) := daeExpMetaHelperConstantNameType(txt, i_expPart, ret_1, out_i_preExp, out_i_varDecls); end daeExpMetaHelperConstant; -protected function lm_499 +protected function lm_497 input Tpl.Text in_txt; input list in_items; input Tpl.Text in_i_varDecls; @@ -23269,7 +23312,7 @@ algorithm i_nameText = Tpl.writeStr(i_nameText, i_cvname); (txt, i_nameText, i_preExp, i_varDecls) = daeExpMetaHelperConstantNameType(txt, i_nameText, i_tp, i_preExp, i_varDecls); txt = Tpl.nextIter(txt); - (txt, i_varDecls, i_preExp) = lm_499(txt, rest, i_varDecls, i_preExp, i_varname); + (txt, i_varDecls, i_preExp) = lm_497(txt, rest, i_varDecls, i_preExp, i_varname); then (txt, i_varDecls, i_preExp); case ( txt, @@ -23280,12 +23323,12 @@ algorithm local list rest; equation - (txt, i_varDecls, i_preExp) = lm_499(txt, rest, i_varDecls, i_preExp, i_varname); + (txt, i_varDecls, i_preExp) = lm_497(txt, rest, i_varDecls, i_preExp, i_varname); then (txt, i_varDecls, i_preExp); end matchcontinue; -end lm_499; +end lm_497; -protected function fun_500 +protected function fun_498 input Tpl.Text in_txt; input list in_i_varLst; input Tpl.Text in_i_varDecls; @@ -23321,13 +23364,13 @@ algorithm equation txt = Tpl.writeTok(txt, Tpl.ST_STRING(", ")); txt = Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE, SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); - (txt, i_varDecls, i_preExp) = lm_499(txt, i_varLst, i_varDecls, i_preExp, i_varname); + (txt, i_varDecls, i_preExp) = lm_497(txt, i_varLst, i_varDecls, i_preExp, i_varname); txt = Tpl.popIter(txt); then (txt, i_varDecls, i_preExp); end matchcontinue; -end fun_500; +end fun_498; -protected function fun_501 +protected function fun_499 input Tpl.Text in_txt; input DAE.ExpType in_i_type; input Tpl.Text in_i_varname; @@ -23406,7 +23449,7 @@ algorithm ret_1 = listLength(i_varLst); ret_2 = SimCode.incrementInt(ret_1, 1); i_start = daeExpMetaHelperBoxStart(emptyTxt, ret_2); - (i_args, i_varDecls, i_preExp) = fun_500(emptyTxt, i_varLst, i_varDecls, i_preExp, i_varname); + (i_args, i_varDecls, i_preExp) = fun_498(emptyTxt, i_varLst, i_varDecls, i_preExp, i_varname); txt = Tpl.writeTok(txt, Tpl.ST_STRING("mmc_mk_box")); txt = Tpl.writeText(txt, i_start); txt = Tpl.writeTok(txt, Tpl.ST_STRING("2, &")); @@ -23425,7 +23468,7 @@ algorithm txt = Tpl.writeText(txt, i_varname); then (txt, i_preExp, i_varDecls); end matchcontinue; -end fun_501; +end fun_499; public function daeExpMetaHelperConstantNameType input Tpl.Text txt; @@ -23439,7 +23482,7 @@ public function daeExpMetaHelperConstantNameType output Tpl.Text out_i_preExp; output Tpl.Text out_i_varDecls; algorithm - (out_txt, out_i_preExp, out_i_varDecls) := fun_501(txt, i_type, i_varname, i_preExp, i_varDecls); + (out_txt, out_i_preExp, out_i_varDecls) := fun_499(txt, i_type, i_varname, i_preExp, i_varDecls); out_i_varname := i_varname; end daeExpMetaHelperConstantNameType; @@ -23578,7 +23621,7 @@ algorithm out_txt := Tpl.writeText(txt, i_newVar); end tempDecl; -protected function fun_505 +protected function fun_503 input Tpl.Text in_txt; input list in_i_instDims; input DAE.ExpType in_i_var_ty; @@ -23605,7 +23648,7 @@ algorithm txt = expTypeArray(txt, i_var_ty); then txt; end matchcontinue; -end fun_505; +end fun_503; public function varType input Tpl.Text in_txt; @@ -23625,7 +23668,7 @@ algorithm list i_instDims; SimCode.Variable i_var; equation - txt = fun_505(txt, i_instDims, i_var_ty); + txt = fun_503(txt, i_instDims, i_var_ty); then txt; case ( txt, @@ -23972,7 +24015,7 @@ algorithm end matchcontinue; end mmcExpTypeShort; -protected function fun_512 +protected function fun_510 input Tpl.Text in_txt; input Boolean in_i_array; input DAE.ExpType in_i_ty; @@ -24004,7 +24047,7 @@ algorithm _ ) then txt; end matchcontinue; -end fun_512; +end fun_510; public function expType input Tpl.Text txt; @@ -24013,7 +24056,7 @@ public function expType output Tpl.Text out_txt; algorithm - out_txt := fun_512(txt, i_array, i_ty); + out_txt := fun_510(txt, i_array, i_ty); end expType; public function expTypeModelica @@ -24079,7 +24122,7 @@ algorithm out_txt := expTypeFromExpFlag(txt, i_exp, 4); end expTypeFromExpArrayIf; -protected function fun_521 +protected function fun_519 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -24108,9 +24151,9 @@ algorithm txt = expTypeShort(txt, i_ty); then txt; end matchcontinue; -end fun_521; +end fun_519; -protected function fun_522 +protected function fun_520 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -24135,12 +24178,12 @@ algorithm local DAE.ExpType i_ty; equation - txt = fun_521(txt, i_ty); + txt = fun_519(txt, i_ty); then txt; end matchcontinue; -end fun_522; +end fun_520; -protected function fun_523 +protected function fun_521 input Tpl.Text in_txt; input DAE.ExpType in_i_ty; @@ -24168,9 +24211,9 @@ algorithm txt = expTypeFlag(txt, i_ty, 2); then txt; end matchcontinue; -end fun_523; +end fun_521; -protected function fun_524 +protected function fun_522 input Tpl.Text in_txt; input Integer in_i_flag; input DAE.ExpType in_i_ty; @@ -24194,7 +24237,7 @@ algorithm 2, i_ty ) equation - txt = fun_522(txt, i_ty); + txt = fun_520(txt, i_ty); then txt; case ( txt, @@ -24209,7 +24252,7 @@ algorithm 4, i_ty ) equation - txt = fun_523(txt, i_ty); + txt = fun_521(txt, i_ty); then txt; case ( txt, @@ -24217,7 +24260,7 @@ algorithm _ ) then txt; end matchcontinue; -end fun_524; +end fun_522; public function expTypeFlag input Tpl.Text txt; @@ -24226,10 +24269,10 @@ public function expTypeFlag output Tpl.Text out_txt; algorithm - out_txt := fun_524(txt, i_flag, i_ty); + out_txt := fun_522(txt, i_flag, i_ty); end expTypeFlag; -protected function fun_526 +protected function fun_524 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24252,9 +24295,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_integer")); then txt; end matchcontinue; -end fun_526; +end fun_524; -protected function fun_527 +protected function fun_525 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24277,9 +24320,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_real")); then txt; end matchcontinue; -end fun_527; +end fun_525; -protected function fun_528 +protected function fun_526 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24302,9 +24345,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_string")); then txt; end matchcontinue; -end fun_528; +end fun_526; -protected function fun_529 +protected function fun_527 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24327,7 +24370,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean")); then txt; end matchcontinue; -end fun_529; +end fun_527; public function expTypeFromExpFlag input Tpl.Text in_txt; @@ -24346,28 +24389,28 @@ algorithm DAE.ICONST(integer = _), i_flag ) equation - txt = fun_526(txt, i_flag); + txt = fun_524(txt, i_flag); then txt; case ( txt, DAE.RCONST(real = _), i_flag ) equation - txt = fun_527(txt, i_flag); + txt = fun_525(txt, i_flag); then txt; case ( txt, DAE.SCONST(string = _), i_flag ) equation - txt = fun_528(txt, i_flag); + txt = fun_526(txt, i_flag); then txt; case ( txt, DAE.BCONST(bool = _), i_flag ) equation - txt = fun_529(txt, i_flag); + txt = fun_527(txt, i_flag); then txt; case ( txt, @@ -24525,7 +24568,7 @@ algorithm end matchcontinue; end expTypeFromExpFlag; -protected function fun_531 +protected function fun_529 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24548,9 +24591,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean")); then txt; end matchcontinue; -end fun_531; +end fun_529; -protected function fun_532 +protected function fun_530 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24573,9 +24616,9 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean")); then txt; end matchcontinue; -end fun_532; +end fun_530; -protected function fun_533 +protected function fun_531 input Tpl.Text in_txt; input Integer in_i_flag; @@ -24598,7 +24641,7 @@ algorithm txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean")); then txt; end matchcontinue; -end fun_533; +end fun_531; public function expTypeFromOpFlag input Tpl.Text in_txt; @@ -24949,7 +24992,7 @@ algorithm local DAE.Operator i_o; equation - txt = fun_531(txt, i_flag); + txt = fun_529(txt, i_flag); then txt; case ( txt, @@ -24958,7 +25001,7 @@ algorithm local DAE.Operator i_o; equation - txt = fun_532(txt, i_flag); + txt = fun_530(txt, i_flag); then txt; case ( txt, @@ -24967,7 +25010,7 @@ algorithm local DAE.Operator i_o; equation - txt = fun_533(txt, i_flag); + txt = fun_531(txt, i_flag); then txt; case ( txt, diff --git a/Compiler/susan_codegen/SimCode/SimCodeC.tpl b/Compiler/susan_codegen/SimCode/SimCodeC.tpl index b9e9f8cf933..1016467f8fc 100644 --- a/Compiler/susan_codegen/SimCode/SimCodeC.tpl +++ b/Compiler/susan_codegen/SimCode/SimCodeC.tpl @@ -3406,12 +3406,11 @@ template daeExpCrefRhs(Exp exp, Context context, Text &preExp /*BUFP*/, match exp // A record cref without subscripts (i.e. a record instance) is handled // by daeExpRecordCrefRhs only in a simulation context, not in a function. - case CREF(componentRef = cr as CREF_IDENT(subscriptLst = {}), - ty = ET_COMPLEX(complexClassType = RECORD(path = _))) then + case CREF(componentRef = cr, ty = t as ET_COMPLEX(complexClassType = RECORD(path = _))) then match context case FUNCTION_CONTEXT(__) then daeExpCrefRhs2(exp, context, preExp, varDecls) else - daeExpRecordCrefRhs(cr, context, preExp, varDecls) + daeExpRecordCrefRhs(t, cr, context, preExp, varDecls) case CREF(componentRef = cr, ty = DAE.ET_FUNCTION_REFERENCE_FUNC(__)) then '(modelica_fnptr)boxptr_<%functionName(cr)%>' else daeExpCrefRhs2(exp, context, preExp, varDecls) @@ -3489,7 +3488,8 @@ template daeExpCrefRhsArrayBox(Exp exp, Context context, Text &preExp /*BUFP*/, ::= match exp case cref as CREF(ty=ET_ARRAY(ty=aty,arrayDimensions=dims)) then - match context case SIMULATION(__) then + match context + case SIMULATION(__) then // For context simulation array variables must be boxed into a real_array // object since they are represented only in a double array. let tmpArr = tempDecl(expTypeArray(aty), &varDecls /*BUFC*/) @@ -3497,28 +3497,30 @@ case cref as CREF(ty=ET_ARRAY(ty=aty,arrayDimensions=dims)) then let dimsValuesStr = (dims |> dim as SOME(i) => i ;separator=", ") let &preExp += '<%expTypeShort(aty)%>_array_create(&<%tmpArr%>, &<%arrayCrefCStr(cref.componentRef)%>, <%dimsLenStr%>, <%dimsValuesStr%>);<%\n%>' tmpArr + case OTHER(__) then + // For context other array variables must be boxed into a real_array + // object since they are represented only in a double array. + let tmpArr = tempDecl(expTypeArray(aty), &varDecls /*BUFC*/) + let dimsLenStr = listLength(dims) + let dimsValuesStr = (dims |> dim as SOME(i) => i ;separator=", ") + let &preExp += '<%expTypeShort(aty)%>_array_create(&<%tmpArr%>, &<%arrayCrefCStr(cref.componentRef)%>, <%dimsLenStr%>, <%dimsValuesStr%>);<%\n%>' + tmpArr end daeExpCrefRhsArrayBox; -template daeExpRecordCrefRhs(ComponentRef cr, Context context, Text &preExp /*BUFP*/, +template daeExpRecordCrefRhs(DAE.ExpType ty, ComponentRef cr, Context context, Text &preExp /*BUFP*/, Text &varDecls /*BUFP*/) ::= -match cr -case CREF_IDENT(identType = DAE.ET_COMPLEX(name = record_path, varLst = var_lst)) then - let record_name = cref(cr) +match ty +case DAE.ET_COMPLEX(name = record_path, varLst = var_lst) then + let vars = (var_lst |> v => '<%daeExp(makeCrefRecordExp(cr,v), context, &preExp /*BUFC*/, &varDecls /*BUFC*/)%>' ;separator=", ") let record_type_name = underscorePath(record_path) let ret_type = '<%record_type_name%>_rettype' let ret_var = tempDecl(ret_type, &varDecls) - let vars = (var_lst |> v => daeExpRecordMemberCref(v, record_name) ;separator=", ") let &preExp += '<%ret_var%> = _<%record_type_name%>(<%vars%>);<%\n%>' '<%ret_var%>.<%ret_type%>_1' end daeExpRecordCrefRhs; -template daeExpRecordMemberCref(ExpVar var, Text recordName) -::= -match var case COMPLEX_VAR(name = var_name) then '<%recordName%>$P<%var_name%>' -end daeExpRecordMemberCref; - template daeExpBinary(Exp exp, Context context, Text &preExp /*BUFP*/, Text &varDecls /*BUFP*/) "Generates code for a binary expression." diff --git a/Compiler/susan_codegen/SimCode/SimCodeTV.mo b/Compiler/susan_codegen/SimCode/SimCodeTV.mo index c36fbcdd74c..f903fc40abe 100644 --- a/Compiler/susan_codegen/SimCode/SimCodeTV.mo +++ b/Compiler/susan_codegen/SimCode/SimCodeTV.mo @@ -322,6 +322,13 @@ package SimCode input Integer increment; output Integer outInt; end incrementInt; + + function makeCrefRecordExp + input DAE.ComponentRef inCRefRecord; + input DAE.ExpVar inVar; + output DAE.Exp outExp; + end makeCrefRecordExp; + end SimCode;