Skip to content

Commit

Permalink
Fixed bug when giving integer values to startTime and stopTime.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2292 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Mar 31, 2006
1 parent 4e66875 commit 4e3d86d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Compiler/Ceval.rml
Expand Up @@ -2036,13 +2036,15 @@ relation calculate_simulation_settings: (Env.Env,Exp.Exp,
rule ceval(env,filenameprefix,true,SOME(st),NONE,msg)
=> (Values.STRING(prefix_str),SOME(st)) &
ceval(env,starttime,true,SOME(st),NONE,msg)
=> (Values.REAL(starttime_r),SOME(st)) &
=> (starttime_v,SOME(st)) &
ceval(env,stoptime,true,SOME(st),NONE,msg)
=> (Values.REAL(stoptime_r),SOME(st)) &
=> (stoptime_v,SOME(st)) &
ceval(env,interval,true,SOME(st),NONE,msg)
=> (Values.INTEGER(interval_i),SOME(st)) &
ceval(env,method,true,SOME(st),NONE,msg)
=> (Values.STRING(method_str),SOME(st)) &
Values.value_real(starttime_v) => starttime_r &
Values.value_real(stoptime_v) => stoptime_r &
int_real(interval_i) => interval_r &
Util.string_append_list([prefix_str,"_init.txt"]) => init_filename
---------------------------------
Expand Down
16 changes: 16 additions & 0 deletions Compiler/Values.rml
Expand Up @@ -90,6 +90,7 @@ with "Absyn.rml"
relation unparse_values: (Value list) => string
relation reverseMatrix: (Value ) => Value
relation value_neg: (Value) => Value
relation value_real: (Value) => real
relation exp_value: Exp.Exp => Value
relation write_ptolemyplot_dataset: (string,Value,string list,string) => int
end
Expand Down Expand Up @@ -412,6 +413,21 @@ relation exp_value: Exp.Exp => Value =
axiom exp_value Exp.BCONST(i) => BOOL(i)
end

(** relation: value_real
**
** Return the real value of a Value. If the value is an integer,
** it is cast to a real.
**)

relation value_real: (Value) => real =

axiom value_real(REAL(r)) => r

rule int_real(i) => r
---------------------
value_real(INTEGER(i)) => r
end

(** relation: value_neg
** author: PA
**
Expand Down

0 comments on commit 4e3d86d

Please sign in to comment.