Change History (8)
follow-up: 7 comment:1 by , 18 years ago
comment:2 by , 11 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.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)))
comment:3 by , 10 years ago
Component: | Backend → Frontend |
---|
comment:6 by , 10 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 , 10 years ago
comment:8 by , 10 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