Changeset 13946


Ignore:
Timestamp:
2012-11-18T05:39:44+01:00 (11 years ago)
Author:
adrpo
Message:
  • make models dumped with +d=scodeInstShortcut able to instantiate when loaded again in OMC. Check differently the last ident if OMC is present otherwise you get: first element is: .Modelica.Fluid.Interfaces.FluidPort_aOMC70 port_a; second element is: .Modelica.Fluid.Interfaces.FluidPort_aOMC88 port_a;
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/FrontEnd/Absyn.mo

    r13930 r13946  
    26412641      Option<ArrayDim> oad1,oad2;
    26422642      list<TypeSpec> lst1,lst2;
     2643      Ident i1, i2;
     2644      Integer pos1, pos2;
     2645
     2646    // first try full equality
    26432647    case(TPATH(p1,oad1), TPATH(p2,oad2))
    26442648      equation
    2645         true = Flags.isSet(Flags.SCODE_INST_SHORTCUT);
     2649        true = pathEqual(p1,p2);
     2650        true = optArrayDimEqual(oad1,oad2);
     2651      then true;
     2652
     2653    // if that didn't work try for different last ident due to +d=scodeInstShortcut
     2654    // first element is:  .Modelica.Fluid.Interfaces.FluidPort_a__OMC__70 port_a;
     2655    // second element is: .Modelica.Fluid.Interfaces.FluidPort_a__OMC__88 port_a;
     2656    case(TPATH(p1,oad1), TPATH(p2,oad2))
     2657      equation
     2658        i1 = pathLastIdent(p1);
     2659        i2 = pathLastIdent(p2);
     2660        pos1 = System.stringFind(i1, "__OMC__");
     2661        true = intNe(pos1, -1);
     2662        pos2 = System.stringFind(i2, "__OMC__");
     2663        true = intNe(pos2, -1);
     2664        true = intEq(pos1, pos2);
     2665        0 = System.strncmp(i1, i2, pos1);
    26462666        p1 = stripLast(p1);
    26472667        p2 = stripLast(p2);
    26482668        true = pathEqual(p1,p2);
    26492669        true = optArrayDimEqual(oad1,oad2);
    2650       then
    2651         true;
    2652     case(TPATH(p1,oad1), TPATH(p2,oad2))
    2653       equation
    2654         true = pathEqual(p1,p2);
    2655         true = optArrayDimEqual(oad1,oad2);
    26562670      then true;
     2671
    26572672    case(TCOMPLEX(p1,lst1,oad1),TCOMPLEX(p2,lst2,oad2))
    26582673      equation
Note: See TracChangeset for help on using the changeset viewer.