Skip to content

Commit

Permalink
Introduced ugly VARVAL hack.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@450 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x97davka committed Sep 28, 1998
1 parent bbb46eb commit f8b1410
Showing 1 changed file with 16 additions and 34 deletions.
50 changes: 16 additions & 34 deletions modeq/dae.rml
Expand Up @@ -24,6 +24,9 @@ module DAE:
datatype Type = REAL | INT | BOOL | STRING

datatype Element = VAR of Exp.ComponentRef * VarKind * Type
(*!ignorecode*)
| VARVAL of Exp.Exp (* Ugly hack *)
(*!includecod*)
| DEFINE of Exp.ComponentRef * Exp.Exp
| EQUATION of Exp.Exp * Exp.Exp
| ALGORITHM of Algorithm.Algorithm
Expand Down Expand Up @@ -115,46 +118,20 @@ relation dump_type =

end

relation dump_element: Element => () =
relation dump_var : (Element, Exp.Exp option) => () =

rule dump_kind kind & dump_type typ &
Exp.print_component_ref id & print "\n"
--------------------------------------
dump_element(VAR(id, kind, typ))

rule print " " & Exp.print_exp e1 &
print " = " & Exp.print_exp e2 & print ";\n"
--------------------------------------
dump_element(EQUATION(e1, e2))

rule RTOpts.modelica_output => false &
print " " & Exp.print_component_ref c &
print " ::= " & Exp.print_exp e & print ";\n"
--------------------------------------
dump_element(DEFINE(c, e))

rule RTOpts.modelica_output => true &
print " " & Exp.print_component_ref c &
print " ::= " & Exp.print_exp e & print ";\n"
Exp.print_component_ref id & print ";\n"
--------------------------------------
dump_element(DEFINE(c, e))

rule print "{ begin " & print id & print " }\n" &
dump contents &
print "{ end " & print id & print " }\n"
--------------------------------------
dump_element ( COMP(id, contents))

end

relation dump_var : Element => () =
dump_var(VAR(id, kind, typ), NONE)

rule dump_kind kind & dump_type typ &
Exp.print_component_ref id & print ";\n"
Exp.print_component_ref id & print " = " &
Exp.print_exp e & print ";\n"
--------------------------------------
dump_var(VAR(id, kind, typ))
dump_var(VAR(id, kind, typ), SOME(e))

axiom dump_var _
axiom dump_var (_,_)

end

Expand Down Expand Up @@ -189,7 +166,12 @@ relation dump_vars: Element list => () =

axiom dump_vars []

rule dump_var first &
rule dump_var (first,SOME(e)) & (* Pretty, eh? *)
dump_vars rest
-------------------
dump_vars VARVAL(e) :: first :: rest

rule dump_var (first,NONE) &
dump_vars rest
-------------------
dump_vars first :: rest
Expand Down

0 comments on commit f8b1410

Please sign in to comment.