Skip to content

Commit

Permalink
Fixed many bugs in flattening of inheritance structure. Now translate…
Browse files Browse the repository at this point in the history
…s Modelica.Electrical.Analog.Sources.SineVoltage

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@938 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Mar 18, 2003
1 parent 522d483 commit 0f1f990
Show file tree
Hide file tree
Showing 9 changed files with 731 additions and 337 deletions.
102 changes: 102 additions & 0 deletions modeq/absyn.rml
Expand Up @@ -325,11 +325,13 @@ module Absyn:
relation path_to_cref : Path => ComponentRef
relation path_string : Path => string
relation path_last_ident : Path => Ident
relation get_cref_from_exp : ( Exp ) => ComponentRef list
relation join_paths: (Path, Path) => Path
relation strip_last: (Path) => Path
relation print_restr : Restriction => ()
relation restr_string : Restriction => string
relation print_absyn_exp : Exp => () (*PR. for debugging.*)

end
with "debug.rml"
with "dump.rml"
Expand Down Expand Up @@ -381,6 +383,106 @@ relation path_last_ident : Path => Ident =

end

relation get_cref_from_exp: ( Exp ) => ComponentRef list =

axiom get_cref_from_exp(INTEGER(_)) => []
axiom get_cref_from_exp(REAL(_)) => []
axiom get_cref_from_exp(STRING(_)) => []
axiom get_cref_from_exp(BOOL(_)) => []
axiom get_cref_from_exp(CREF(cr)) => [cr]

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res
-------------------------
get_cref_from_exp(BINARY(e1,op,e2)) => res

rule get_cref_from_exp(e1) => res
----------------------------
get_cref_from_exp(UNARY(op,e1)) => res

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res
-------------------------
get_cref_from_exp(LBINARY(e1,op,e2)) => res

rule get_cref_from_exp(e1) => res
----------------------------
get_cref_from_exp(LUNARY(op,e1)) => res

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res
-------------------------
get_cref_from_exp(RELATION(e1,op,e2)) => res

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res1 &
get_cref_from_exp(e3) => l3 &
list_append(res1,l3) => res
(* TODO elseif's e4 *)
---------------------------
get_cref_from_exp(IFEXP(e1,e2,e3,e4)) => res

rule (*Util.list_map(expl,get_cref_from_exp) => res*)
get_cref_from_farg(farg) => res
--------------------------------------------
get_cref_from_exp(CALL(_,farg)) => res


rule Util.list_map(expl,get_cref_from_exp) => res1 &
Util.list_flatten(res1) => res
--------------------------------------------
get_cref_from_exp(ARRAY(expl)) => res

rule Util.list_list_map(expll,get_cref_from_exp) => res1 &
Util.list_flatten(res1) => res2 &
Util.list_flatten(res2) => res
----------------
get_cref_from_exp(MATRIX(expll)) => res

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res1 &
get_cref_from_exp(e3) => l3 &
list_append(res1,l3) => res
---------------------------
get_cref_from_exp(RANGE(e1,SOME(e3),e2)) => res

rule get_cref_from_exp(e1) => l1 &
get_cref_from_exp(e2) => l2 &
list_append(l1,l2) => res
---------------------------
get_cref_from_exp(RANGE(e1,NONE,e2)) => res

rule (*Util.list_map(expl,get_cref_from_exp) => res*)
Print.print_buf "Not implemented yet\n"
------------------
get_cref_from_exp(TUPLE(expl)) => []

end

relation get_cref_from_farg: (FunctionArgs) => ComponentRef list =

rule Util.list_map(expl, get_cref_from_exp) => l1 &
Util.list_flatten(l1) => fl1 &
Util.list_map(nargl,get_cref_from_narg) => l2 &
Util.list_flatten(l2) => fl2 &
list_append(fl1,fl2) => res
--------------------------------------------
get_cref_from_farg (FUNCTIONARGS(expl,nargl)) => res

end

relation get_cref_from_narg: (NamedArg) => ComponentRef list =

rule get_cref_from_exp(exp) => res
-----------------------------
get_cref_from_narg(NAMEDARG(_,exp)) => res
end


relation join_paths: (Path, Path) => (Path) =

Expand Down
15 changes: 5 additions & 10 deletions modeq/dae.rml
Expand Up @@ -357,16 +357,11 @@ end
relation dump_elements_str : Element list => string =

rule dump_vars_str l => s1 &
string_append(s1,"initial equation\n") => s2 &
dump_initialequations_str(l) => s3 &
string_append(s2,s3) => s4 &
string_append(s4,"equation\n") => s5 &
dump_equations_str(l) => s6 &
string_append(s5,s6) => s7 &
dump_initialalgorithms_str(l) => s8 &
string_append(s7,s8) => s9 &
dump_algorithms_str(l) => s10 &
string_append(s9,s10) => str
dump_initialequations_str(l) => s2 &
dump_equations_str(l) => s3 &
dump_initialalgorithms_str(l) => s4 &
dump_algorithms_str(l) => s5 &
Util.string_append_list([s1,"initial equation\n",s2,"initial algorithm\n",s4,"equation\n",s3,"algorithm\n",s5]) => str
---------------------------
dump_elements_str l => str

Expand Down

0 comments on commit 0f1f990

Please sign in to comment.