Skip to content

Commit

Permalink
Fixed icon annotaiton bug again...
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1580 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Mar 17, 2005
1 parent a5a1771 commit 2093c27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 57 deletions.
2 changes: 1 addition & 1 deletion modeq/dump.rml
Expand Up @@ -2283,7 +2283,7 @@ relation get_option_str: ('a option, 'a => string) => string =
------------
get_option_str (SOME(a),r) => str

axiom get_option_str(NONE,_) => "NONE"
axiom get_option_str(NONE,_) => ""
end

relation unparse_string_comment_option: string option => string =
Expand Down
56 changes: 7 additions & 49 deletions modeq/inst.rml
Expand Up @@ -2031,7 +2031,7 @@ relation inst_var2 : (Env.Env,
Prefix.prefix_cref(pre,Exp.CREF_IDENT(n,[])) => cr &
(* Do all dimensions... *)
inst_dim_exp_lst(dims,impl) => dims' &
dae_declare(cr,ty,attr,NONE,dims',NONE) => dae &
dae_declare(cr,ty,attr,NONE,dims',NONE,NONE) => dae &
make_array_type(dims,ty) => arrty
-------------------------------
inst_var2(env,ci_state as ClassInf.FUNCTION(_),mod,pre,csets,n,cl,attr,dims as _::_,idxs,inst_dims,impl)
Expand Down Expand Up @@ -2514,8 +2514,9 @@ relation inst_array : (Env.Env,
)
=> (DAE.Element list, Connect.Sets, Types.Type) =

(* rule (* If is a function var.*)
Mod.mod_equation(mod) => SOME(Types.TYPED(e,p)) & (* Which has an expression binding *)
rule (* If is a function var.*)
Mod.mod_equation(mod) => SOME(Types.TYPED(e,p)) & (* Which has an
expression binding *)
inst_class(env,mod,pre,csets,cl,inst_dims,true,INNER_CALL)
=> (_,_,_,ty,st) &
(* Check their types... *)
Expand All @@ -2526,10 +2527,8 @@ relation inst_array : (Env.Env,
---------------------------------------------------
inst_array(env,ci_state as ClassInf.FUNCTION(_),mod,pre,csets,n,(cl,attr),i,DIMEXP(_,_),dims,idxs,inst_dims,impl)
=> ([dae],[],ty)
*)

rule print "DIMEXP in inst_array\n" &
inst_var2(env,ci_state,mod,pre,csets,n,cl,attr,dims,i::idxs,inst_dims,impl)
rule inst_var2(env,ci_state,mod,pre,csets,n,cl,attr,dims,i::idxs,inst_dims,impl)
=> (dae,csets,ty)
-----------------
inst_array(env,ci_state,mod,pre,csets,n,(cl,attr),i,DIMEXP(_,_),dims,idxs,inst_dims,impl)
Expand All @@ -2540,8 +2539,7 @@ relation inst_array : (Env.Env,
inst_array(env,ci_state,mod,pre,csets,n,(cl,attr),i,DIMINT(stop),dims,idxs,inst_dims,impl)
=> ([], csets, (Types.T_NOTYPE,NONE))

(*
rule (* Modifiers of arrays that are functioncall, eg. Real x[:]=foo(...) *)
rule (* Modifiers of arrays that are functioncall, eg. Real x[:]=foo(...) *)
(* Should only generate -one- functioncall *)
Mod.mod_equation(mod) => SOME(Types.TYPED(e,p)) &
Exp.contain_functioncall(e) => true &
Expand All @@ -2558,13 +2556,8 @@ relation inst_array : (Env.Env,
-----------------------------
inst_array(env,ci_state,mod,pre,csets,n,(cl,attr),i,DIMINT(stop),dims,idxs,inst_dims,impl)
=> (dae,csets',ty)
*)

rule Mod.lookup_idx_modification(mod,i) => mod' &
Mod.print_mod_str mod' => str &
Debug.fprint("failtrace", "inst array, mod' =") &
Debug.fprint("failtrace", str) &
Debug.fprint("failtrace", "\n") &
inst_var2(env,ci_state,mod',pre,csets,n,cl,attr,dims,i::idxs,inst_dims,impl)
=> (dae1,csets',ty) &
int_add(i,1) => i' &
Expand Down Expand Up @@ -3976,20 +3969,6 @@ relation inst_eq_equation : (Exp.Exp, Types.Properties,
e2,p2 as Types.PROP_TUPLE(t2,_), initial,impl)
=> dae


(*
rule
print("\n So far so good.") &

print("\n ")
------------------------------------------
inst_eq_equation(e1,p1 as Types.PROP_TUPLE(t1,_),
e2,Types.PROP_TUPLE(t2,_))
=> fail
*)



(* PR. *)
rule (*Debug.print("\ninst_eq_equation(e2) PROP_TUPLE, PROP_TUPLE") &
Debug.print "\n About to do a static match e2. " &*)
Expand Down Expand Up @@ -4033,27 +4012,6 @@ relation inst_eq_equation : (Exp.Exp, Types.Properties,
----------
inst_eq_equation(e1,Types.PROP(t1,_), e2,Types.PROP(t2,_), initial,impl) => fail


(* PR To debug*)

rule (* Debug.fprintln("failtrace", "\ne1 is PROP and e2 is PROP_TUPLE. ") &
Types.print_type t1 &
Types.print_type t2 *)
------------------------------------------------------------------
inst_eq_equation(e1,Types.PROP(t1,_), e2, Types.PROP_TUPLE(t2,_), initial,impl) => fail

rule (*Debug.fprintln("failtrace", "\ne2 is PROP") &
print "\n----- e2 is PROP: " &
Types.print_type t2 *)
-------------------------------------------
inst_eq_equation(e1,_, e2,Types.PROP(t2,_), initial,impl) => fail

rule (*Debug.fprintln("failtrace", "e1 is PROP") &
print "\n----- e2 is PROP: " &
Types.print_type t1 *)
-----------------------------------------
inst_eq_equation(e1,Types.PROP(t1,_), e2, _, initial,impl) => fail

(* No match. *)
rule Debug.fprintln("failtrace", "\n No match in inst_eq_equation. ")
---------------------------------
Expand Down Expand Up @@ -5425,7 +5383,7 @@ relation inst_record_constructor_elt : (Env.Env,SCode.Element, bool (*impl*)) =>
elab_arraydim(env,owncref,dim,NONE,false,NONE) => dimexp &
Debug.fprint ("recconst", "calling inst_var\n") &
inst_var(cenv, ClassInf.FUNCTION(""),mod', Prefix.NOPRE, [], id, cl, attr,
dimexp, [], [], false (*impl*) ) => (_, _, tp') &
dimexp, [], [], impl ) => (_, _, tp') &
Debug.fprint ("recconst", "Type of argument:") &
Debug.fcall ("recconst",Types.print_type,tp') &
Debug.fprint ("recconst","\nMod=") &
Expand Down
10 changes: 3 additions & 7 deletions modeq/interactive.rml
Expand Up @@ -3259,7 +3259,7 @@ relation get_connection_annotation_str: Absyn.EquationItem => string =
parsestr = "Ok" &
SCode.elaborate(p) => p' &
Inst.make_env_from_program(p',Absyn.IDENT("")) => env &
Static.elab_graphics_exp(env,Absyn.CALL(Absyn.CREF_IDENT("Line",[]),fargs), true (*impl*)) => (newexp,_) &
Static.elab_graphics_exp(env,Absyn.CALL(Absyn.CREF_IDENT("Line",[]),fargs), false (*impl*)) => (newexp,_) &
Exp.print_exp_str(newexp) => gexpstr
-------------------------------------------------
get_connection_annotation_str(Absyn.EQUATIONITEM(Absyn.EQ_CONNECT(_,_), SOME(Absyn.COMMENT(SOME(Absyn.ANNOTATION([Absyn.MODIFICATION(_,_,Absyn.CREF_IDENT("Line",_),SOME(Absyn.CLASSMOD(elts,NONE)),_)])),_))))
Expand Down Expand Up @@ -3574,23 +3574,19 @@ end

relation get_annotation_string: (string,Absyn.Annotation) => string =

rule print "get_annotation_string. \n" &
strip_graphics_modification(mod) => (stripmod,[Absyn.MODIFICATION(_,_,_,SOME(Absyn.CLASSMOD(_,SOME(graphicexp))),_)]) &
print "stripped graphics mod\n" &
rule strip_graphics_modification(mod) => (stripmod,[Absyn.MODIFICATION(_,_,_,SOME(Absyn.CLASSMOD(_,SOME(graphicexp))),_)]) &
SCode.build_mod(SOME(Absyn.CLASSMOD(stripmod,NONE)),false) => mod' &
print "built mod\n" &
Parser.parsestring totstring => (p,parsestr) & (* Always succeeds, check parsestr for errors *)
parsestr = "Ok" &
SCode.elaborate(p) => p' &
Inst.make_simple_env_from_program(p',Absyn.IDENT("Icon")) => env &
get_class_in_program("Icon",p) => placementc &
SCode.elab_class(placementc) => placementclass &
Mod.elab_mod (env,Prefix.NOPRE,mod',false) => mod'' &
print "elabed mod\n" &
Inst.inst_class(env, mod'', Prefix.NOPRE, [], placementclass,
[], false,Inst.TOP_CALL)
=> (dae, _, cs, t, state) &
print "insted class\n" &

(* Put bindings of variables as expressions inside variable elements of the dae instead of equations *)
Inst.init_vars_modelica_output dae => dae' &
DAE.get_variable_bindings_str dae' => str &
Expand Down

0 comments on commit 2093c27

Please sign in to comment.