Skip to content

Commit

Permalink
Fix for #2143:
Browse files Browse the repository at this point in the history
- Print out element-wise operators in flattened code when appropriate.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15776 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Apr 10, 2013
1 parent c24c0e1 commit 84e7ec8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
24 changes: 12 additions & 12 deletions Compiler/FrontEnd/DAEDump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Dump operator to a string."
input DAE.Operator op;
output String str;
algorithm
str := matchcontinue(op)
str := match(op)
local
Absyn.Path p;
DAE.Type ty;
Expand Down Expand Up @@ -233,8 +233,8 @@ algorithm
case(DAE.EQUAL(ty=ty)) then " EQUAL ";
case(DAE.NEQUAL(ty=ty)) then " NEQUAL ";
case(DAE.USERDEFINED(p)) then " Userdefined:" +& Absyn.pathString(p) +& " ";
case(_) then " --UNDEFINED-- ";
end matchcontinue;
else " --UNDEFINED-- ";
end match;
end dumpOperatorString;

public function dumpOperatorSymbol "
Expand All @@ -243,29 +243,29 @@ Dump operator to a string."
input DAE.Operator op;
output String str;
algorithm
str := matchcontinue(op)
str := match(op)
local
Absyn.Path p;
case(DAE.ADD(_)) then " + ";
case(DAE.SUB(_)) then " - ";
case(DAE.MUL(_)) then " * ";
case(DAE.MUL(_)) then " .* ";
case(DAE.DIV(_)) then " / ";
case(DAE.POW(_)) then " ^ ";
case(DAE.UMINUS(_)) then " - ";
case(DAE.UMINUS_ARR(_)) then " - ";
case(DAE.ADD_ARR(_)) then " + ";
case(DAE.SUB_ARR(_)) then " - ";
case(DAE.MUL_ARR(_)) then " * ";
case(DAE.DIV_ARR(_)) then " / ";
case(DAE.MUL_ARR(_)) then " .* ";
case(DAE.DIV_ARR(_)) then " ./ ";
case(DAE.MUL_ARRAY_SCALAR(_)) then " * ";
case(DAE.ADD_ARRAY_SCALAR(_)) then " .+ ";
case(DAE.SUB_SCALAR_ARRAY(_)) then " .- ";
case(DAE.MUL_SCALAR_PRODUCT(_)) then " * ";
case(DAE.MUL_MATRIX_PRODUCT(_)) then " * ";
case(DAE.DIV_ARRAY_SCALAR(_)) then " / ";
case(DAE.DIV_SCALAR_ARRAY(_)) then " / ";
case(DAE.POW_ARRAY_SCALAR(_)) then " ^ ";
case(DAE.POW_SCALAR_ARRAY(_)) then " ^ ";
case(DAE.DIV_SCALAR_ARRAY(_)) then " ./ ";
case(DAE.POW_ARRAY_SCALAR(_)) then " .^ ";
case(DAE.POW_SCALAR_ARRAY(_)) then " .^ ";
case(DAE.POW_ARR(_)) then " ^ ";
case(DAE.POW_ARR2(_)) then " .^ ";
case(DAE.OR(_)) then " or ";
Expand All @@ -278,8 +278,8 @@ algorithm
case(DAE.EQUAL(_)) then " == ";
case(DAE.NEQUAL(_)) then " <> ";
case(DAE.USERDEFINED(p)) then " Userdefined:" +& Absyn.pathString(p) +& " ";
case(_) then " --UNDEFINED-- ";
end matchcontinue;
else " --UNDEFINED-- ";
end match;
end dumpOperatorSymbol;

public function dump2str "
Expand Down
30 changes: 15 additions & 15 deletions Compiler/Template/ExpressionDumpTpl.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ match op
case POW(__) then '^'
case ADD_ARR(__) then '+ /* ADD_ARR */'
case SUB_ARR(__) then '- /* SUB_ARR */'
case MUL_ARR(__) then '* /* MUL_ARR */'
case DIV_ARR(__) then '/ /* DIV_ARR */'
case MUL_ARR(__) then '.* /* MUL_ARR */'
case DIV_ARR(__) then './ /* DIV_ARR */'
case POW_ARR(__) then '^ /* POW_ARR */'
case POW_ARR2(__) then '^ /* POW_ARR2 */'
case POW_ARR2(__) then '.^ /* POW_ARR2 */'
case MUL_ARRAY_SCALAR(__) then '* /* MUL_ARR_SCA */'
case ADD_ARRAY_SCALAR(__) then '+ /* ADD_ARR_SCA */'
case SUB_SCALAR_ARRAY(__) then '- /* SUB_SCA_ARR */'
case POW_SCALAR_ARRAY(__) then '^ /* POW_SCA_ARR */'
case POW_ARRAY_SCALAR(__) then '^ /* POW_ARR_SCA */'
case ADD_ARRAY_SCALAR(__) then '.+ /* ADD_ARR_SCA */'
case SUB_SCALAR_ARRAY(__) then '.- /* SUB_SCA_ARR */'
case POW_SCALAR_ARRAY(__) then '.^ /* POW_SCA_ARR */'
case POW_ARRAY_SCALAR(__) then '.^ /* POW_ARR_SCA */'
case MUL_SCALAR_PRODUCT(__) then '* /* MUL_SCA_PRO */'
case MUL_MATRIX_PRODUCT(__) then '* /* MUL_MAT_PRO */'
case DIV_SCALAR_ARRAY(__) then '/ /* DIV_SCA_ARR */'
Expand All @@ -253,18 +253,18 @@ match op
case POW(__) then '^'
case ADD_ARR(__) then '+'
case SUB_ARR(__) then '-'
case MUL_ARR(__) then '*'
case DIV_ARR(__) then '/'
case MUL_ARR(__) then '.*'
case DIV_ARR(__) then './'
case POW_ARR(__) then '^'
case POW_ARR2(__) then '^'
case POW_ARR2(__) then '.^'
case MUL_ARRAY_SCALAR(__) then '*'
case ADD_ARRAY_SCALAR(__) then '+'
case SUB_SCALAR_ARRAY(__) then '-'
case POW_SCALAR_ARRAY(__) then '^'
case POW_ARRAY_SCALAR(__) then '^'
case ADD_ARRAY_SCALAR(__) then '.+'
case SUB_SCALAR_ARRAY(__) then '.-'
case POW_SCALAR_ARRAY(__) then '.^'
case POW_ARRAY_SCALAR(__) then '.^'
case MUL_SCALAR_PRODUCT(__) then '*'
case MUL_MATRIX_PRODUCT(__) then '*'
case DIV_SCALAR_ARRAY(__) then '/'
case DIV_SCALAR_ARRAY(__) then './'
case DIV_ARRAY_SCALAR(__) then '/'
else errorMsg("ExpressionDumpTpl.dumpBinOp: Unknown operator.")
end dumpBinOp;
Expand Down

0 comments on commit 84e7ec8

Please sign in to comment.