Change History (8)
follow-up: 7 comment:1 by , 19 years ago
comment:2 by , 12 years ago
| Component: | → Backend |
|---|
I modified a little bit the dumping of flat modelica trying NOT to change the output if the +m flag is not present.
I'm attaching a patch if you guys want to include it in the trunk (or I can commit the change).
Regards
Fede
Index: Compiler/Template/ExpressionDumpTpl.mo
===================================================================
--- Compiler/Template/ExpressionDumpTpl.mo (revision 16189)
+++ Compiler/Template/ExpressionDumpTpl.mo (working copy)
@@ -1133,6 +1133,49 @@
out_txt := Tpl.popIter(out_txt);
end dumpExpListCrefs;
+protected function fun_33
+ input Tpl.Text in_txt;
+ input Boolean in_mArg;
+ input Tpl.Text in_a_cref__str;
+ input Tpl.Text in_a_sub__str;
+ input DAE.Ident in_a_ident;
+
+ output Tpl.Text out_txt;
+algorithm
+ out_txt :=
+ match(in_txt, in_mArg, in_a_cref__str, in_a_sub__str, in_a_ident)
+ local
+ Tpl.Text txt;
+ Tpl.Text a_cref__str;
+ Tpl.Text a_sub__str;
+ DAE.Ident a_ident;
+
+ case ( txt,
+ false,
+ a_cref__str,
+ a_sub__str,
+ a_ident )
+ equation
+ txt = Tpl.writeStr(txt, a_ident);
+ txt = Tpl.writeText(txt, a_sub__str);
+ txt = Tpl.writeTok(txt, Tpl.ST_STRING("."));
+ txt = Tpl.writeText(txt, a_cref__str);
+ then txt;
+
+ case ( txt,
+ _,
+ a_cref__str,
+ a_sub__str,
+ a_ident )
+ equation
+ txt = Tpl.writeStr(txt, a_ident);
+ txt = Tpl.writeText(txt, a_sub__str);
+ txt = Tpl.writeTok(txt, Tpl.ST_STRING("__"));
+ txt = Tpl.writeText(txt, a_cref__str);
+ then txt;
+ end match;
+end fun_33;
+
public function dumpCref
input Tpl.Text in_txt;
input DAE.ComponentRef in_a_cref;
@@ -1147,6 +1190,7 @@
Integer i_index;
DAE.Ident i_ident;
list<DAE.Subscript> i_subscriptLst;
+ Boolean ret_2;
Tpl.Text l_cref__str;
Tpl.Text l_sub__str;
@@ -1174,10 +1218,8 @@
equation
l_sub__str = dumpSubscripts(Tpl.emptyTxt, i_subscriptLst);
l_cref__str = dumpCref(Tpl.emptyTxt, i_componentRef);
- txt = Tpl.writeStr(txt, i_ident);
- txt = Tpl.writeText(txt, l_sub__str);
- txt = Tpl.writeTok(txt, Tpl.ST_STRING("."));
- txt = Tpl.writeText(txt, l_cref__str);
+ ret_2 = Config.modelicaOutput();
+ txt = fun_33(txt, ret_2, l_cref__str, l_sub__str, i_ident);
then txt;
case ( txt,
@@ -1194,7 +1236,7 @@
end match;
end dumpCref;
-protected function lm_34
+protected function lm_35
input Tpl.Text in_txt;
input list<DAE.Subscript> in_items;
@@ -1216,10 +1258,10 @@
equation
txt = dumpSubscript(txt, i_sub);
txt = Tpl.nextIter(txt);
- txt = lm_34(txt, rest);
+ txt = lm_35(txt, rest);
then txt;
end match;
-end lm_34;
+end lm_35;
public function dumpSubscripts
input Tpl.Text in_txt;
@@ -1242,7 +1284,7 @@
i_subscripts )
equation
l_sub__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(",")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_sub__str = lm_34(l_sub__str, i_subscripts);
+ l_sub__str = lm_35(l_sub__str, i_subscripts);
l_sub__str = Tpl.popIter(l_sub__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("["));
txt = Tpl.writeText(txt, l_sub__str);
@@ -1341,7 +1383,7 @@
end match;
end dumpReductionIterator;
-protected function fun_38
+protected function fun_39
input Tpl.Text in_txt;
input Boolean in_mArg;
input Tpl.Text in_a_op__str;
@@ -1370,9 +1412,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING(")"));
then txt;
end match;
-end fun_38;
+end fun_39;
-protected function fun_39
+protected function fun_40
input Tpl.Text in_txt;
input DAE.Exp in_a_operand;
input Boolean in_a_lhs;
@@ -1413,10 +1455,10 @@
ret_0 = Expression.priority(a_operation, a_lhs);
ret_1 = Expression.priority(i_operand, a_lhs);
ret_2 = intLt(ret_0, ret_1);
- txt = fun_38(txt, ret_2, a_op__str);
+ txt = fun_39(txt, ret_2, a_op__str);
then txt;
end match;
-end fun_39;
+end fun_40;
public function dumpOperand
input Tpl.Text txt;
@@ -1429,10 +1471,10 @@
Tpl.Text l_op__str;
algorithm
l_op__str := dumpExp(Tpl.emptyTxt, a_operand, "\"");
- out_txt := fun_39(txt, a_operand, a_lhs, a_operation, l_op__str);
+ out_txt := fun_40(txt, a_operand, a_lhs, a_operation, l_op__str);
end dumpOperand;
-protected function fun_41
+protected function fun_42
input Tpl.Text in_txt;
input DAE.Operator in_a_op;
@@ -1569,9 +1611,9 @@
txt = errorMsg(txt, "ExpressionDumpTpl.dumpBinOp: Unknown operator.");
then txt;
end match;
-end fun_41;
+end fun_42;
-protected function fun_42
+protected function fun_43
input Tpl.Text in_txt;
input DAE.Operator in_a_op;
@@ -1708,9 +1750,9 @@
txt = errorMsg(txt, "ExpressionDumpTpl.dumpBinOp: Unknown operator.");
then txt;
end match;
-end fun_42;
+end fun_43;
-protected function fun_43
+protected function fun_44
input Tpl.Text in_txt;
input Boolean in_mArg;
input DAE.Operator in_a_op;
@@ -1727,17 +1769,17 @@
false,
a_op )
equation
- txt = fun_41(txt, a_op);
+ txt = fun_42(txt, a_op);
then txt;
case ( txt,
_,
a_op )
equation
- txt = fun_42(txt, a_op);
+ txt = fun_43(txt, a_op);
then txt;
end match;
-end fun_43;
+end fun_44;
public function dumpBinOp
input Tpl.Text txt;
@@ -1748,7 +1790,7 @@
Boolean ret_0;
algorithm
ret_0 := Config.typeinfo();
- out_txt := fun_43(txt, ret_0, a_op);
+ out_txt := fun_44(txt, ret_0, a_op);
end dumpBinOp;
public function dumpUnaryOp
@@ -1905,7 +1947,7 @@
end match;
end dumpRelationOp;
-protected function lm_49
+protected function lm_50
input Tpl.Text in_txt;
input list<DAE.FuncArg> in_items;
@@ -1927,12 +1969,12 @@
equation
txt = dumpFuncArg(txt, i_arg);
txt = Tpl.nextIter(txt);
- txt = lm_49(txt, rest);
+ txt = lm_50(txt, rest);
then txt;
end match;
-end lm_49;
+end lm_50;
-protected function lm_50
+protected function lm_51
input Tpl.Text in_txt;
input list<DAE.Type> in_items;
@@ -1954,12 +1996,12 @@
equation
txt = dumpType(txt, i_ty);
txt = Tpl.nextIter(txt);
- txt = lm_50(txt, rest);
+ txt = lm_51(txt, rest);
then txt;
end match;
-end lm_50;
+end lm_51;
-protected function lm_51
+protected function lm_52
input Tpl.Text in_txt;
input list<DAE.Type> in_items;
@@ -1981,10 +2023,10 @@
equation
txt = dumpType(txt, i_ty);
txt = Tpl.nextIter(txt);
- txt = lm_51(txt, rest);
+ txt = lm_52(txt, rest);
then txt;
end match;
-end lm_51;
+end lm_52;
public function dumpType
input Tpl.Text in_txt;
@@ -2071,7 +2113,7 @@
DAE.T_FUNCTION(funcArg = i_funcArg, funcResultType = i_funcResultType) )
equation
l_arg__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_arg__str = lm_49(l_arg__str, i_funcArg);
+ l_arg__str = lm_50(l_arg__str, i_funcArg);
l_arg__str = Tpl.popIter(l_arg__str);
l_ret__str = dumpType(Tpl.emptyTxt, i_funcResultType);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("<function>("));
@@ -2096,7 +2138,7 @@
DAE.T_TUPLE(tupleType = i_tupleType) )
equation
l_ty__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_ty__str = lm_50(l_ty__str, i_tupleType);
+ l_ty__str = lm_51(l_ty__str, i_tupleType);
l_ty__str = Tpl.popIter(l_ty__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("("));
txt = Tpl.writeText(txt, l_ty__str);
@@ -2121,7 +2163,7 @@
DAE.T_METATUPLE(types = i_types) )
equation
l_ty__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_ty__str = lm_51(l_ty__str, i_types);
+ l_ty__str = lm_52(l_ty__str, i_types);
l_ty__str = Tpl.popIter(l_ty__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("tuple<"));
txt = Tpl.writeText(txt, l_ty__str);
@@ -2222,7 +2264,7 @@
end match;
end dumpFuncArg;
-protected function lm_54
+protected function lm_55
input Tpl.Text in_txt;
input DAE.Dimensions in_items;
@@ -2244,10 +2286,10 @@
equation
txt = dumpDimension(txt, i_dim);
txt = Tpl.nextIter(txt);
- txt = lm_54(txt, rest);
+ txt = lm_55(txt, rest);
then txt;
end match;
-end lm_54;
+end lm_55;
public function dumpDimensions
input Tpl.Text txt;
@@ -2256,7 +2298,7 @@
output Tpl.Text out_txt;
algorithm
out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- out_txt := lm_54(out_txt, a_dims);
+ out_txt := lm_55(out_txt, a_dims);
out_txt := Tpl.popIter(out_txt);
end dumpDimensions;
@@ -2442,7 +2484,7 @@
end match;
end dumpMatchCase;
-protected function lm_60
+protected function lm_61
input Tpl.Text in_txt;
input list<DAE.Pattern> in_items;
@@ -2464,10 +2506,10 @@
equation
txt = dumpPattern(txt, i_pat);
txt = Tpl.nextIter(txt);
- txt = lm_60(txt, rest);
+ txt = lm_61(txt, rest);
then txt;
end match;
-end lm_60;
+end lm_61;
public function dumpPatterns
input Tpl.Text txt;
@@ -2476,11 +2518,11 @@
output Tpl.Text out_txt;
algorithm
out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- out_txt := lm_60(out_txt, a_patterns);
+ out_txt := lm_61(out_txt, a_patterns);
out_txt := Tpl.popIter(out_txt);
end dumpPatterns;
-protected function lm_62
+protected function lm_63
input Tpl.Text in_txt;
input list<tuple<DAE.Pattern, String, DAE.Type>> in_items;
@@ -2502,10 +2544,10 @@
equation
txt = dumpNamedPattern(txt, i_pat);
txt = Tpl.nextIter(txt);
- txt = lm_62(txt, rest);
+ txt = lm_63(txt, rest);
then txt;
end match;
-end lm_62;
+end lm_63;
public function dumpPattern
input Tpl.Text in_txt;
@@ -2586,7 +2628,7 @@
equation
l_name__str = AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name);
l_pat__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_pat__str = lm_62(l_pat__str, i_patterns_1);
+ l_pat__str = lm_63(l_pat__str, i_patterns_1);
l_pat__str = Tpl.popIter(l_pat__str);
txt = Tpl.writeText(txt, l_name__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("("));
@@ -2655,7 +2697,7 @@
end match;
end dumpNamedPattern;
-protected function fun_65
+protected function fun_66
input Tpl.Text in_txt;
input Boolean in_a_scalar;
@@ -2678,9 +2720,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING("/* scalar */ "));
then txt;
end match;
-end fun_65;
+end fun_66;
-protected function fun_66
+protected function fun_67
input Tpl.Text in_txt;
input Boolean in_mArg;
input Boolean in_a_scalar;
@@ -2702,12 +2744,12 @@
_,
a_scalar )
equation
- txt = fun_65(txt, a_scalar);
+ txt = fun_66(txt, a_scalar);
then txt;
end match;
-end fun_66;
+end fun_67;
-protected function lm_67
+protected function lm_68
input Tpl.Text in_txt;
input list<list<DAE.Exp>> in_items;
input String in_a_stringDelimiter;
@@ -2733,12 +2775,12 @@
equation
txt = dumpExpList(txt, i_row, a_stringDelimiter, ", ");
txt = Tpl.nextIter(txt);
- txt = lm_67(txt, rest, a_stringDelimiter);
+ txt = lm_68(txt, rest, a_stringDelimiter);
then txt;
end match;
-end lm_67;
+end lm_68;
-protected function fun_68
+protected function fun_69
input Tpl.Text in_txt;
input Boolean in_mArg;
input DAE.Type in_a_ty;
@@ -2767,9 +2809,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING(" */ "));
then txt;
end match;
-end fun_68;
+end fun_69;
-protected function fun_69
+protected function fun_70
input Tpl.Text in_txt;
input Option<DAE.Exp> in_a_step;
input DAE.Exp in_a_e;
@@ -2796,9 +2838,9 @@
_ )
then txt;
end match;
-end fun_69;
+end fun_70;
-protected function fun_70
+protected function fun_71
input Tpl.Text in_txt;
input Tpl.Text in_a_needs__paren;
@@ -2819,9 +2861,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING("("));
then txt;
end match;
-end fun_70;
+end fun_71;
-protected function fun_71
+protected function fun_72
input Tpl.Text in_txt;
input Tpl.Text in_a_needs__paren;
@@ -2842,9 +2884,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING(")"));
then txt;
end match;
-end fun_71;
+end fun_72;
-protected function fun_72
+protected function fun_73
input Tpl.Text in_txt;
input Tpl.Text in_a_needs__paren;
@@ -2865,9 +2907,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING("("));
then txt;
end match;
-end fun_72;
+end fun_73;
-protected function fun_73
+protected function fun_74
input Tpl.Text in_txt;
input Tpl.Text in_a_needs__paren;
@@ -2888,9 +2930,9 @@
txt = Tpl.writeTok(txt, Tpl.ST_STRING(")"));
then txt;
end match;
-end fun_73;
+end fun_74;
-protected function fun_74
+protected function fun_75
input Tpl.Text in_txt;
input Option<DAE.Exp> in_a_sz;
input String in_a_stringDelimiter;
@@ -2917,9 +2959,9 @@
_ )
then txt;
end match;
-end fun_74;
+end fun_75;
-protected function lm_75
+protected function lm_76
input Tpl.Text in_txt;
input DAE.ReductionIterators in_items;
input String in_a_stringDelimiter;
@@ -2945,12 +2987,12 @@
equation
txt = dumpReductionIterator(txt, i_it, a_stringDelimiter);
txt = Tpl.nextIter(txt);
- txt = lm_75(txt, rest, a_stringDelimiter);
+ txt = lm_76(txt, rest, a_stringDelimiter);
then txt;
end match;
-end lm_75;
+end lm_76;
-protected function lm_76
+protected function lm_77
input Tpl.Text in_txt;
input list<DAE.MatchCase> in_items;
@@ -2972,10 +3014,10 @@
equation
txt = dumpMatchCase(txt, i_c);
txt = Tpl.nextIter(txt);
- txt = lm_76(txt, rest);
+ txt = lm_77(txt, rest);
then txt;
end match;
-end lm_76;
+end lm_77;
public function dumpExpCrefs
input Tpl.Text in_txt;
@@ -3198,7 +3240,7 @@
equation
l_expl = dumpExpList(Tpl.emptyTxt, i_array, a_stringDelimiter, ", ");
ret_10 = Config.typeinfo();
- txt = fun_66(txt, ret_10, i_scalar);
+ txt = fun_67(txt, ret_10, i_scalar);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("{"));
txt = Tpl.writeText(txt, l_expl);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("}"));
@@ -3209,10 +3251,10 @@
a_stringDelimiter )
equation
l_mat__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING("}, {")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_mat__str = lm_67(l_mat__str, i_matrix, a_stringDelimiter);
+ l_mat__str = lm_68(l_mat__str, i_matrix, a_stringDelimiter);
l_mat__str = Tpl.popIter(l_mat__str);
ret_12 = Config.typeinfo();
- txt = fun_68(txt, ret_12, i_ty);
+ txt = fun_69(txt, ret_12, i_ty);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("{{"));
txt = Tpl.writeText(txt, l_mat__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("}}"));
@@ -3223,7 +3265,7 @@
_ )
equation
l_start__str = dumpOperand(Tpl.emptyTxt, i_start, i_e, false);
- l_step__str = fun_69(Tpl.emptyTxt, i_step, i_e);
+ l_step__str = fun_70(Tpl.emptyTxt, i_step, i_e);
l_stop__str = dumpOperand(Tpl.emptyTxt, i_stop, i_e, false);
txt = Tpl.writeText(txt, l_start__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING(":"));
@@ -3256,8 +3298,8 @@
a_stringDelimiter )
equation
l_needs__paren = parenthesizeSubExp(Tpl.emptyTxt, i_exp);
- l_lparen = fun_70(Tpl.emptyTxt, l_needs__paren);
- l_rparen = fun_71(Tpl.emptyTxt, l_needs__paren);
+ l_lparen = fun_71(Tpl.emptyTxt, l_needs__paren);
+ l_rparen = fun_72(Tpl.emptyTxt, l_needs__paren);
l_exp__str = dumpExp(Tpl.emptyTxt, i_exp, a_stringDelimiter);
l_sub__str = dumpExpList(Tpl.emptyTxt, i_sub, a_stringDelimiter, ", ");
txt = Tpl.writeText(txt, l_lparen);
@@ -3273,8 +3315,8 @@
a_stringDelimiter )
equation
l_needs__paren = parenthesizeSubExp(Tpl.emptyTxt, i_exp);
- l_lparen = fun_72(Tpl.emptyTxt, l_needs__paren);
- l_rparen = fun_73(Tpl.emptyTxt, l_needs__paren);
+ l_lparen = fun_73(Tpl.emptyTxt, l_needs__paren);
+ l_rparen = fun_74(Tpl.emptyTxt, l_needs__paren);
l_exp__str = dumpExp(Tpl.emptyTxt, i_exp, a_stringDelimiter);
txt = Tpl.writeText(txt, l_lparen);
txt = Tpl.writeText(txt, l_exp__str);
@@ -3289,7 +3331,7 @@
a_stringDelimiter )
equation
l_exp__str = dumpExp(Tpl.emptyTxt, i_exp, a_stringDelimiter);
- l_dim__str = fun_74(Tpl.emptyTxt, i_sz, a_stringDelimiter);
+ l_dim__str = fun_75(Tpl.emptyTxt, i_sz, a_stringDelimiter);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("size("));
txt = Tpl.writeText(txt, l_exp__str);
txt = Tpl.writeText(txt, l_dim__str);
@@ -3328,7 +3370,7 @@
l_name__str = AbsynDumpTpl.dumpPathNoQual(Tpl.emptyTxt, i_name);
l_exp__str = dumpExp(Tpl.emptyTxt, i_expr, a_stringDelimiter);
l_iter__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_iter__str = lm_75(l_iter__str, i_iterators, a_stringDelimiter);
+ l_iter__str = lm_76(l_iter__str, i_iterators, a_stringDelimiter);
l_iter__str = Tpl.popIter(l_iter__str);
txt = Tpl.writeText(txt, l_name__str);
txt = Tpl.writeTok(txt, Tpl.ST_STRING("("));
@@ -3406,7 +3448,7 @@
l_match__ty = dumpMatchType(Tpl.emptyTxt, i_matchType);
l_inputs__str = dumpExpList(Tpl.emptyTxt, i_inputs, a_stringDelimiter, ", ");
l_case__str = Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
- l_case__str = lm_76(l_case__str, i_cases);
+ l_case__str = lm_77(l_case__str, i_cases);
l_case__str = Tpl.popIter(l_case__str);
txt = Tpl.writeText(txt, l_match__ty);
txt = Tpl.writeTok(txt, Tpl.ST_STRING(" ("));
Index: Compiler/Template/ExpressionDumpTpl.tpl
===================================================================
--- Compiler/Template/ExpressionDumpTpl.tpl (revision 16189)
+++ Compiler/Template/ExpressionDumpTpl.tpl (working copy)
@@ -177,6 +177,9 @@
case CREF_QUAL(__) then
let sub_str = dumpSubscripts(subscriptLst)
let cref_str = dumpCref(componentRef)
+ if Config.modelicaOutput() then
+ '<%ident%><%sub_str%>__<%cref_str%>'
+ else
'<%ident%><%sub_str%>.<%cref_str%>'
case WILD() then '_'
else errorMsg("ExpressionDumpTpl.dumpCref: unknown cref")
Index: Compiler/Template/ExpressionDumpTV.mo
===================================================================
--- Compiler/Template/ExpressionDumpTV.mo (revision 16189)
+++ Compiler/Template/ExpressionDumpTV.mo (working copy)
@@ -770,6 +770,9 @@
function typeinfo
output Boolean flag;
end typeinfo;
+ function modelicaOutput
+ output Boolean flag;
+ end modelicaOutput;
end Config;
package Types
Index: Compiler/FrontEnd/DAEDump.mo
===================================================================
--- Compiler/FrontEnd/DAEDump.mo (revision 16189)
+++ Compiler/FrontEnd/DAEDump.mo (working copy)
@@ -41,6 +41,7 @@
// public imports
public import DAE;
public import Graphviz;
+public import System;
public import IOStream;
public import SCode;
@@ -3222,13 +3223,15 @@
case (DAE.COMP(ident = n,dAElist = l,comment = c), str)
equation
str = IOStream.append(str, "class ");
- str = IOStream.append(str, n);
+// str = IOStream.append(str, n);
+ str = IOStream.append(str, Util.if_(Config.modelicaOutput(),System.stringReplace(n,".","__") ,n));
str = IOStream.append(str, dumpCommentStr(c));
str = IOStream.append(str, "\n");
str = dumpElementsStream(l, str);
str = IOStream.append(str, dumpClassAnnotationStr(c));
str = IOStream.append(str, "end ");
- str = IOStream.append(str, n);
+// str = IOStream.append(str, n);
+ str = IOStream.append(str, Util.if_(Config.modelicaOutput(),System.stringReplace(n,".","__") ,n));
str = IOStream.append(str, ";\n");
then
str;
@@ -3476,7 +3479,8 @@
case ((DAE.WHEN_EQUATION(condition = e,equations = xs1,elsewhen_ = SOME(el), source = src) :: xs), str)
equation
sourceStr = getSourceInformationStr(src);
- str = IOStream.append(str, "when ");
+ //str = IOStream.append(str, "when ");
+ str = IOStream.append(str, Util.if_(Config.modelicaOutput(),"when ","when "));
str = IOStream.append(str, ExpressionDump.printExpStr(e));
str = IOStream.append(str, " then\n");
str = dumpEquationsStream(xs1, str);
@@ -3488,7 +3492,8 @@
case ((DAE.WHEN_EQUATION(condition = e,equations = xs1,elsewhen_ = NONE(), source = src) :: xs), str)
equation
sourceStr = getSourceInformationStr(src);
- str = IOStream.append(str, " when ");
+ //str = IOStream.append(str, " when ");
+ str = IOStream.append(str, Util.if_(Config.modelicaOutput(),"when "," when "));
str = IOStream.append(str, ExpressionDump.printExpStr(e));
str = IOStream.append(str, " then\n");
str = dumpEquationsStream(xs1, str);
@@ -3730,6 +3735,24 @@
DAE.VarVisibility prot;
DAE.InstDims dims;
IOStream.IOStream str;
+
+ // Skip enums if modelica output
+ case (DAE.VAR(componentRef = id,
+ kind = kind,
+ direction = dir,
+ parallelism = prl,
+ protection=prot,
+ ty = DAE.T_ENUMERATION (source=_),
+ dims = dims,
+ binding = _,
+ source = source,
+ variableAttributesOption = dae_var_attr,
+ absynCommentOption = comment), _, str)
+ equation
+ true = Config.modelicaOutput();
+ str = IOStream.appendList(str,{" "});
+ then
+ str;
// no binding
case (DAE.VAR(componentRef = id,
kind = kind,
@@ -3745,7 +3768,7 @@
equation
sFinal = Util.if_(DAEUtil.getFinalAttr(dae_var_attr),"final ", "");
s1 = dumpKindStr(kind);
- s2 = dumpDirectionStr(dir);
+ s2 = Util.if_(Config.modelicaOutput() ,"", dumpDirectionStr(dir));
s3 = unparseType(typ);
s3_subs = unparseDimensions(dims, printTypeDimension);
s4 = ComponentReference.printComponentRefStr(id);
@@ -3771,7 +3794,8 @@
equation
sFinal = Util.if_(DAEUtil.getFinalAttr(dae_var_attr),"final ", "");
s1 = dumpKindStr(kind);
- s2 = dumpDirectionStr(dir);
+ //s2 = dumpDirectionStr(dir);
+ s2 = Util.if_(Config.modelicaOutput() ,"", dumpDirectionStr(dir));
s3 = unparseType(typ);
s3_subs = unparseDimensions(dims, printTypeDimension);
s4 = ComponentReference.printComponentRefStr(id);
Index: Compiler/Main/Main.mo
===================================================================
--- Compiler/Main/Main.mo (revision 16189)
+++ Compiler/Main/Main.mo (working copy)
@@ -892,7 +892,7 @@
case d
equation
true = Config.modelicaOutput();
- print("DEPRECATED: modelicaOutput option no longer needed\n");
+ print("/*DEPRECATED: modelicaOutput option no longer needed*/\n");
then
d;
case ((d as DAE.DAE(elementLst = dae)))
Version 0, edited 12 years ago by (next)
comment:3 by , 11 years ago
| Component: | Backend → Frontend |
|---|
comment:6 by , 11 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Closing as wontfix because I don't see how it can be done currently. Maybe some front-end dump could be used to proceed. But it will not be the textual mof-file.
comment:7 by , 11 years ago
comment:8 by , 11 years ago
Probably. Tons of outdated stuff is in there. We should have the information in latex so we can easily comment out outdated sections.
Note:
See TracTickets
for help on using tickets.

From the Manual "Open Modelica System":
$omc file.mof
should put the instantiated code from file.mo into file.mof. This does not work.
I do this
$omc file.mo > file.mof
From the manual:
$omc +s file.mof
should generate simulation code. This does not work either. Instead I get the
following msg:
$omc +s file.mof
[DynModelExam.mof:1:1-1:1:writable]: Parse error: unexpected token: fclass
#|Execution failed!
Execution failed!
p.s: I am using the latest version from the nightly build