Skip to content

Commit

Permalink
- make models dumped with +d=scodeInstShortcut able to instantiate wh…
Browse files Browse the repository at this point in the history
…en loaded again in OMC.

  Check differently the last ident if __OMC__ is present otherwise you get:
  first element is:  .Modelica.Fluid.Interfaces.FluidPort_a__OMC__70 port_a;
  second element is: .Modelica.Fluid.Interfaces.FluidPort_a__OMC__88 port_a;


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13946 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 18, 2012
1 parent b7a7195 commit ac2680a
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Compiler/FrontEnd/Absyn.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2640,20 +2640,35 @@ algorithm
Path p1,p2;
Option<ArrayDim> oad1,oad2;
list<TypeSpec> lst1,lst2;
Ident i1, i2;
Integer pos1, pos2;

// first try full equality
case(TPATH(p1,oad1), TPATH(p2,oad2))
equation
true = Flags.isSet(Flags.SCODE_INST_SHORTCUT);
p1 = stripLast(p1);
p2 = stripLast(p2);
true = pathEqual(p1,p2);
true = optArrayDimEqual(oad1,oad2);
then
true;
then true;

// if that didn't work try for different last ident due to +d=scodeInstShortcut
// first element is: .Modelica.Fluid.Interfaces.FluidPort_a__OMC__70 port_a;
// second element is: .Modelica.Fluid.Interfaces.FluidPort_a__OMC__88 port_a;
case(TPATH(p1,oad1), TPATH(p2,oad2))
equation
i1 = pathLastIdent(p1);
i2 = pathLastIdent(p2);
pos1 = System.stringFind(i1, "__OMC__");
true = intNe(pos1, -1);
pos2 = System.stringFind(i2, "__OMC__");
true = intNe(pos2, -1);
true = intEq(pos1, pos2);
0 = System.strncmp(i1, i2, pos1);
p1 = stripLast(p1);
p2 = stripLast(p2);
true = pathEqual(p1,p2);
true = optArrayDimEqual(oad1,oad2);
then true;

case(TCOMPLEX(p1,lst1,oad1),TCOMPLEX(p2,lst2,oad2))
equation
true = pathEqual(p1,p2);
Expand Down

0 comments on commit ac2680a

Please sign in to comment.