Skip to content

Commit f881685

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Fix visualization (ticket:5319).
- Use the derived node in ConvertDAE.addComponentTypeToSource. - Check for "Shape" instead of "Shape$" in VisualXML.hasVisPath. - Clean up some left over debug stringification in VisualXML. Belonging to [master]: - OpenModelica/OMCompiler#3000
1 parent b70342a commit f881685

File tree

3 files changed

+28
-29
lines changed

3 files changed

+28
-29
lines changed

Compiler/BackEnd/VisualXML.mo

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ algorithm
551551
case(BackendDAE.VAR(source=source))
552552
algorithm
553553
paths := ElementSource.getElementSourceTypes(source);
554-
_ := list(Absyn.pathString(p) for p in paths);
555-
//print("paths_lst "+stringDelimitList(paths_lst, "; ")+"\n");
554+
//_ := list(Absyn.pathString(p) for p in paths);
555+
//print("paths_lst "+stringDelimitList(paths_lst, "; ")+"\n");
556556
(obj,_) := hasVisPath(paths,1);
557557
then Util.stringNotEqual(obj,"");
558558
else
@@ -568,30 +568,29 @@ author:Waurich TUD 2015-04"
568568
output tuple<list<BackendDAE.Var>,list<DAE.ComponentRef>> tplOut;
569569
algorithm
570570
tplOut := matchcontinue(var,tplIn)
571-
local
572-
Boolean b;
573-
Integer idx;
574-
BackendDAE.Type varType;
575-
DAE.ComponentRef varName, cref;
576-
list<DAE.ComponentRef> crefs;
577-
DAE.ElementSource source;
578-
list<BackendDAE.Var> varLst;
579-
String obj;
580-
list<Absyn.Path> paths;
581-
list<String> paths_lst;
582-
case(BackendDAE.VAR(varName=varName, source=source), (varLst,crefs))
571+
local
572+
Integer idx;
573+
DAE.ComponentRef varName, cref;
574+
list<DAE.ComponentRef> crefs;
575+
DAE.ElementSource source;
576+
list<BackendDAE.Var> varLst;
577+
String obj;
578+
list<Absyn.Path> paths;
579+
580+
case (BackendDAE.VAR(varName=varName, source=source), (varLst,crefs))
583581
algorithm
584-
paths := ElementSource.getElementSourceTypes(source);
585-
_ := list(Absyn.pathString(p) for p in paths);
586-
//print("paths_lst "+stringDelimitList(paths_lst, "; ")+"\n");
587-
(obj,idx) := hasVisPath(paths,1);
588-
true := Util.stringNotEqual(obj,"");
589-
//print("ComponentRef "+ComponentReference.printComponentRefStr(varName)+" path: "+obj+ " idx: "+intString(idx)+"\n");
590-
cref := ComponentReference.firstNCrefs(varName,idx-1);
591-
crefs := List.unique(cref::crefs);
592-
then (var::varLst,crefs);
593-
else
594-
then tplIn;
582+
paths := ElementSource.getElementSourceTypes(source);
583+
//print("Component " + ComponentReference.printComponentRefStr(varName) + ":\n");
584+
//print(List.toString(paths, Absyn.pathStringDefault, "", " ", "\n ", "", false) + "\n");
585+
(obj,idx) := hasVisPath(paths,1);
586+
true := Util.stringNotEqual(obj,"");
587+
//print("ComponentRef "+ComponentReference.printComponentRefStr(varName)+" path: "+obj+ " idx: "+intString(idx)+"\n");
588+
cref := ComponentReference.firstNCrefs(varName,idx-1);
589+
crefs := List.unique(cref::crefs);
590+
then
591+
(var::varLst, crefs);
592+
593+
else tplIn;
595594
end matchcontinue;
596595
end isVisualizationVarFold;
597596

@@ -617,8 +616,8 @@ algorithm
617616
then (name,num);
618617
case(Absyn.QUALIFIED(name="Modelica",path=Absyn.QUALIFIED(name="Mechanics",path=Absyn.QUALIFIED(name="MultiBody",path=Absyn.QUALIFIED(name="Visualizers",path=Absyn.QUALIFIED(name="Advanced",path=Absyn.IDENT(name=name))))))::_,_)
619618
algorithm
620-
shapeIdent := stringAppendList(List.firstN(stringListStringChar(name),6));
621-
true := stringEqual(shapeIdent,"Shape$");
619+
shapeIdent := substring(name, 1, 5);
620+
true := stringEqual(shapeIdent,"Shape");
622621
then (name,numIn);
623622
case(_::rest,_)
624623
algorithm

Compiler/FrontEnd/MetaModelicaBuiltin.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ function substring
611611
input String str;
612612
input Integer start "start index, first character is 1";
613613
input Integer stop "stop index, first character is 1";
614-
output String out "Length is stop-start";
614+
output String out "Length is stop-start+1";
615615
external "builtin";
616616
end substring;
617617

Compiler/NFFrontEnd/NFConvertDAE.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ algorithm
203203
case ComponentRef.CREF()
204204
algorithm
205205
source := ElementSource.addElementSourceType(source,
206-
InstNode.scopePath(InstNode.classScope(InstNode.parent(cref.node))));
206+
InstNode.scopePath(InstNode.classScope(InstNode.getDerivedNode(InstNode.parent(cref.node)))));
207207
then
208208
addComponentTypeToSource(cref.restCref, source);
209209

0 commit comments

Comments
 (0)