Skip to content

Commit

Permalink
made the relation merge work better with partial classes and the same…
Browse files Browse the repository at this point in the history
… modifiers

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1297 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Oct 1, 2004
1 parent 48e22f7 commit 834e2dd
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions modeq/mod.rml
Expand Up @@ -718,17 +718,27 @@ relation merge : (Types.Mod, Types.Mod,Env.Env,Prefix.Prefix) => Types.Mod =
,env,pre)
=> Types.REDECL(f1,[(SCode.COMPONENT(id1,f,r,p,attr,tp,SCode.NOMOD,bc),m'')])

axiom merge(Types.REDECL(f1,els as [(SCode.COMPONENT(id1,_,_,_,_,_,_,_),_)]),
Types.MOD(_,subs,_),env,pre)
=> Types.MOD(false,Types.NAMEMOD(id1,Types.REDECL(f1,els))::subs,
NONE)

axiom merge(mod as Types.REDECL(f1,els as [(SCode.COMPONENT(id1,_,_,_,_,_,_,_),_)]),
mods as Types.MOD(_,subs,_),env,pre)
(*luc_pop : this shoud return the first mod because it have been merged in merge_subs*)
(* => Types.MOD(false,Types.NAMEMOD(id1,Types.REDECL(f1,els))::subs,
NONE)*)
=> mod
(*end luc_pop*)

axiom merge(Types.MOD(_,subs,_),
Types.REDECL(f1,els as [(SCode.COMPONENT(id1,_,_,_,_,_,_,_),_)]),
env,pre)
=> Types.MOD(false,Types.NAMEMOD(id1,Types.REDECL(f1,els))::subs,
NONE)

(*luc_pop: this is needed to catch it there are the same.*)
(* it matches a a dc-motor with RampVoltage *)
rule outer = inner
-----------------------------------------
merge(outer,inner,_,_) => outer
(* end luc_pop*)

rule Print.print_buf "# trying to modify final element\n"
------------------------------------------
merge(_,m as Types.MOD(true,_,_),_,_) => fail
Expand All @@ -739,11 +749,9 @@ relation merge : (Types.Mod, Types.Mod,Env.Env,Prefix.Prefix) => Types.Mod =
merge(Types.MOD(final,subs1,ass1), Types.MOD(false,subs2,ass2),env,pre)
=> Types.MOD(final,subs,ass)

rule Print.print_buf "# incomplete handling of modification merging. Outer:" &
print_mod outer & Print.print_buf " inner:" &
print_mod inner
-----------------------------------------------------
merge(outer,inner,_,_) => outer


axiom merge(outer,inner,_,_) => outer

end

Expand Down Expand Up @@ -860,7 +868,9 @@ end

relation print_final : bool => () =

axiom print_final false
rule Print.print_buf " NOT final "
--------------
print_final false

rule Print.print_buf " final "
--------------
Expand Down

0 comments on commit 834e2dd

Please sign in to comment.