Skip to content

Commit

Permalink
Fixed bug with Diagram in component annotations.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@922 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Feb 20, 2003
1 parent b715396 commit b676ce0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
14 changes: 10 additions & 4 deletions modeq/dump.rml
Expand Up @@ -278,11 +278,17 @@ relation unparse_class_modification_str: Absyn.Modification => string =

axiom unparse_class_modification_str(Absyn.CLASSMOD([],_)) => ""

rule get_string_list(l,unparse_element_arg_str,",") => s1 &
rule get_string_list(l,unparse_element_arg_str,",") => s1 &
string_append("(",s1) => s2 &
string_append(s2,")") => str
---------------------------------------------------------
unparse_class_modification_str(Absyn.CLASSMOD(l,_)) => str
unparse_class_modification_str(Absyn.CLASSMOD(l,NONE)) => str

rule print_exp_str e => s1 &
Util.string_append_list(["=",s1]) => str
---------------------------------------------------------
unparse_class_modification_str(Absyn.CLASSMOD(_,SOME(e))) => str


end
(**)
Expand Down Expand Up @@ -495,8 +501,8 @@ end
relation unparse_annotation_option: Absyn.Annotation option => string =

rule unparse_class_modification_str Absyn.CLASSMOD(mod,NONE) => s1 &
string_append(" annotation(",s1) => s2 &
string_append(s2,")") => str
string_append(" annotation",s1) => s2 &
string_append(s2,"") => str
----------------------------
unparse_annotation_option(SOME(Absyn.ANNOTATION(mod))) => str

Expand Down
16 changes: 0 additions & 16 deletions modeq/inst.rml
Expand Up @@ -935,27 +935,11 @@ relation inst_element : (Env, Mod, Prefix, Connect.Sets, ClassInf.State,

Mod.merge(classmod',mm') => mod &
Mod.merge(mod,m') => mod1 &
<<<<<<< inst.rml
Debug.fprintln ("redecl", "Merged modifications") &
Debug.fcall ("redecl", Mod.print_mod, mod1) &
print "inst_element :" & print n & print "before redeclare\n" &
redeclare_type(mod1,comp,env2,pre,impl) => (SCode.COMPONENT(n,final,repl,prot,
=======

redeclare_type(mod1,comp,env2,pre,impl) => (SCode.COMPONENT(n,final,repl,prot,
>>>>>>> 1.127
attr as SCode.ATTR(ad,flow,acc,param,dir),
<<<<<<< inst.rml
t,m),mod',env2') &
print "inst_element :" & print n & print "after redeclare\n" &
Debug.fprintln ("redecl", "Merged modifications") &
Debug.fcall ("redecl", Mod.print_mod, mod') &


=======
t,m),mod',env2') &

>>>>>>> 1.127
Debug.fprint("insttr", "looking for type") &
Debug.fcall("insttr",Dump.print_path,t) &
Debug.fprint("insttr"," in env:") &
Expand Down
26 changes: 21 additions & 5 deletions modeq/interactive.rml
Expand Up @@ -1963,15 +1963,15 @@ relation get_componentitems_annotation: Absyn.ComponentItem list => string =
string_append(s3,str) => res
----------------------------
get_componentitems_annotation (Absyn.COMPONENTITEM(_,SOME(Absyn.COMMENT(SOME(
Absyn.ANNOTATION(Absyn.MODIFICATION(_,_,Absyn.CREF_IDENT("Diagram",_),Absyn.CLASSMOD(mod,_),_)::_)
Absyn.ANNOTATION(mod as Absyn.MODIFICATION(_,_,Absyn.CREF_IDENT("Placement",_),_,_)::_)
),_)))::(rest as (_::_))) => res

rule get_annotation_string(Placement_records, Absyn.ANNOTATION(mod)) => s1 &
string_append("{",s1) => s2 &
string_append(s2,"}") => res
----------------------------
get_componentitems_annotation ([Absyn.COMPONENTITEM(_,SOME(Absyn.COMMENT(SOME(
Absyn.ANNOTATION(Absyn.MODIFICATION(_,_,Absyn.CREF_IDENT("Diagram",_),Absyn.CLASSMOD(mod,_),_)::_)
Absyn.ANNOTATION(mod as Absyn.MODIFICATION(_,_, Absyn.CREF_IDENT("Placement",_),_,_)::_)
),_)))]) => res

rule get_componentitems_annotation(rest) => str &
Expand Down Expand Up @@ -2585,14 +2585,26 @@ end
**)
relation record_constructor_to_modification: (Absyn.Exp ) => Absyn.ElementArg =

rule Util.list_map(nargs,namedarg_to_modification) => eltarglst &
rule (* Covers the case annotate=Diagram(x=1,y=2) *)
Util.list_map(nargs,namedarg_to_modification) => eltarglst &
let res = Absyn.MODIFICATION(false,Absyn.NON_EACH,cr,Absyn.CLASSMOD(eltarglst,NONE),NONE)
-----------------------------------
record_constructor_to_modification(Absyn.CALL(cr,Absyn.FUNCTIONARGS([],nargs))) => res

rule (* Covers the case annotate=Diagram(SOMETHING(x=1,y=2)) *)
Util.list_map(nargs,namedarg_to_modification) => eltarglst &
record_constructor_to_modification(e) => emod &
let res = Absyn.MODIFICATION(false, Absyn.NON_EACH,
cr, Absyn.CLASSMOD(emod::eltarglst, NONE), NONE)
-----------------------------------
record_constructor_to_modification(Absyn.CALL(cr,
Absyn.FUNCTIONARGS([e as Absyn.CALL(_,_)],nargs))) => res

rule Print.print_buf "record_constructor_to_modification failed\n"

rule Print.print_buf "record_constructor_to_modification failed, exp=" &
Absyn.print_absyn_exp e & Print.print_buf "\n"
-------------------------
record_constructor_to_modification(_) => fail
record_constructor_to_modification(e) => fail
end

(** relation: namedarg_to_modification
Expand All @@ -2609,4 +2621,8 @@ relation namedarg_to_modification: (Absyn.NamedArg) => Absyn.ElementArg =
rule let res = Absyn.MODIFICATION(false,Absyn.NON_EACH,Absyn.CREF_IDENT(id,[]),Absyn.CLASSMOD([],SOME(e)),NONE)
----------------------------------------------------------------
namedarg_to_modification( Absyn.NAMEDARG(id,e)) => res

rule Print.print_buf "- namedarg_to_modification failed\n"
----------------
namedarg_to_modification(_) => fail
end

0 comments on commit b676ce0

Please sign in to comment.