Skip to content

Commit

Permalink
- fixed a bug in SimCodeC.daeExpAsub() in the last case where context…
Browse files Browse the repository at this point in the history
… condition should be FUNCTION_CONTEXT vs. other contexts (did not work for OTHER context)

- removed a redundant case (repetitive code) with Susan's "or case" feature in SimCodeC.daeExpMatrix()
- a new version of C# code generator (better array support in functions, mainly 2D slicing)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5953 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
pavolpr committed Aug 25, 2010
1 parent df41f5a commit 17363ad
Show file tree
Hide file tree
Showing 4 changed files with 717 additions and 436 deletions.
32 changes: 16 additions & 16 deletions Compiler/SimCodeC.mo
Expand Up @@ -23288,46 +23288,46 @@ protected function fun_504
input SimCode.Context in_i_context;
input Tpl.Text in_i_varDecls;
input Tpl.Text in_i_preExp;
input Tpl.Text in_i_arrName;
input list<DAE.Exp> in_i_subs;
input DAE.ExpType in_i_ecr_ty;
input Tpl.Text in_i_arrName;

output Tpl.Text out_txt;
output Tpl.Text out_i_varDecls;
output Tpl.Text out_i_preExp;
algorithm
(out_txt, out_i_varDecls, out_i_preExp) :=
matchcontinue(in_txt, in_i_context, in_i_varDecls, in_i_preExp, in_i_arrName, in_i_subs, in_i_ecr_ty)
matchcontinue(in_txt, in_i_context, in_i_varDecls, in_i_preExp, in_i_subs, in_i_ecr_ty, in_i_arrName)
local
Tpl.Text txt;
Tpl.Text i_varDecls;
Tpl.Text i_preExp;
Tpl.Text i_arrName;
list<DAE.Exp> i_subs;
DAE.ExpType i_ecr_ty;
Tpl.Text i_arrName;

case ( txt,
(i_context as SimCode.SIMULATION(genDiscrete = _)),
SimCode.FUNCTION_CONTEXT(),
i_varDecls,
i_preExp,
i_arrName,
i_subs,
i_ecr_ty )
local
SimCode.Context i_context;
_,
_,
i_arrName )
equation
(txt, i_preExp, i_varDecls) = arrayScalarRhs(txt, i_ecr_ty, i_subs, Tpl.textString(i_arrName), i_context, i_preExp, i_varDecls);
txt = Tpl.writeText(txt, i_arrName);
then (txt, i_varDecls, i_preExp);

case ( txt,
_,
i_context,
i_varDecls,
i_preExp,
i_arrName,
_,
_ )
i_subs,
i_ecr_ty,
i_arrName )
local
SimCode.Context i_context;
equation
txt = Tpl.writeText(txt, i_arrName);
(txt, i_preExp, i_varDecls) = arrayScalarRhs(txt, i_ecr_ty, i_subs, Tpl.textString(i_arrName), i_context, i_preExp, i_varDecls);
then (txt, i_varDecls, i_preExp);
end matchcontinue;
end fun_504;
Expand Down Expand Up @@ -23499,7 +23499,7 @@ algorithm
equation
ret_1 = SimCode.buildCrefExpFromAsub(i_ecr, i_subs);
(i_arrName, i_preExp, i_varDecls) = daeExpCrefRhs(emptyTxt, ret_1, i_context, i_preExp, i_varDecls);
(txt, i_varDecls, i_preExp) = fun_504(txt, i_context, i_varDecls, i_preExp, i_arrName, i_subs, i_ecr_ty);
(txt, i_varDecls, i_preExp) = fun_504(txt, i_context, i_varDecls, i_preExp, i_subs, i_ecr_ty, i_arrName);
then (txt, i_preExp, i_varDecls);

case ( txt,
Expand Down

0 comments on commit 17363ad

Please sign in to comment.