Skip to content

Commit

Permalink
- Fix type of ENUM_LITERAL expressions in Susan
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Nov 8, 2010
1 parent b6437a9 commit 7412337
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
50 changes: 41 additions & 9 deletions Compiler/SimCodeC.mo
Expand Up @@ -30731,6 +30731,31 @@ algorithm
end matchcontinue;
end fun_675;

protected function fun_676
input Tpl.Text in_txt;
input Integer in_i_flag;

output Tpl.Text out_txt;
algorithm
out_txt :=
matchcontinue(in_txt, in_i_flag)
local
Tpl.Text txt;

case ( txt,
1 )
equation
txt = Tpl.writeTok(txt, Tpl.ST_STRING("integer"));
then txt;

case ( txt,
_ )
equation
txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_integer"));
then txt;
end matchcontinue;
end fun_676;

public function expTypeFromExpFlag
input Tpl.Text in_txt;
input DAE.Exp in_i_exp;
Expand Down Expand Up @@ -30772,6 +30797,13 @@ algorithm
txt = fun_675(txt, i_flag);
then txt;

case ( txt,
DAE.ENUM_LITERAL(name = _),
i_flag )
equation
txt = fun_676(txt, i_flag);
then txt;

case ( txt,
(i_e as DAE.BINARY(operator = i_e_operator)),
i_flag )
Expand Down Expand Up @@ -30927,7 +30959,7 @@ algorithm
end matchcontinue;
end expTypeFromExpFlag;

protected function fun_677
protected function fun_678
input Tpl.Text in_txt;
input Integer in_i_flag;

Expand All @@ -30950,9 +30982,9 @@ algorithm
txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
then txt;
end matchcontinue;
end fun_677;
end fun_678;

protected function fun_678
protected function fun_679
input Tpl.Text in_txt;
input Integer in_i_flag;

Expand All @@ -30975,9 +31007,9 @@ algorithm
txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
then txt;
end matchcontinue;
end fun_678;
end fun_679;

protected function fun_679
protected function fun_680
input Tpl.Text in_txt;
input Integer in_i_flag;

Expand All @@ -31000,7 +31032,7 @@ algorithm
txt = Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
then txt;
end matchcontinue;
end fun_679;
end fun_680;

public function expTypeFromOpFlag
input Tpl.Text in_txt;
Expand Down Expand Up @@ -31351,7 +31383,7 @@ algorithm
local
DAE.Operator i_o;
equation
txt = fun_677(txt, i_flag);
txt = fun_678(txt, i_flag);
then txt;

case ( txt,
Expand All @@ -31360,7 +31392,7 @@ algorithm
local
DAE.Operator i_o;
equation
txt = fun_678(txt, i_flag);
txt = fun_679(txt, i_flag);
then txt;

case ( txt,
Expand All @@ -31369,7 +31401,7 @@ algorithm
local
DAE.Operator i_o;
equation
txt = fun_679(txt, i_flag);
txt = fun_680(txt, i_flag);
then txt;

case ( txt,
Expand Down
2 changes: 2 additions & 0 deletions Compiler/susan_codegen/SimCode/SimCodeC.tpl
Expand Up @@ -2519,6 +2519,7 @@ end crefToMStr;




template subscriptsToMStr(list<Subscript> subscripts)
::=
if subscripts then
Expand Down Expand Up @@ -5540,6 +5541,7 @@ template expTypeFromExpFlag(Exp exp, Integer flag)
case RCONST(__) then match flag case 1 then "real" else "modelica_real"
case SCONST(__) then match flag case 1 then "string" else "modelica_string"
case BCONST(__) then match flag case 1 then "boolean" else "modelica_boolean"
case ENUM_LITERAL(__) then match flag case 1 then "integer" else "modelica_integer"
case e as BINARY(__)
case e as UNARY(__)
case e as LBINARY(__)
Expand Down

0 comments on commit 7412337

Please sign in to comment.