Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
verimag
synchrone
lutin
Commits
874bebce
Commit
874bebce
authored
May 29, 2012
by
Erwan Jahier
Browse files
Add a -gnuplot option to lutin.
parent
54ca28be
Changes
5
Hide whitespace changes
Inline
Side-by-side
source/Lurettetop/runDirect.ml
View file @
874bebce
...
...
@@ -289,6 +289,9 @@ let (f : unit -> int) =
flush
sim2chro_oc
;
if
args
.
display_gnuplot
&&
!
gnuplot_time
=
0
.
0
(* gnuplot_oc will be useful to refresh the gnuplot from here
(cf Lutin/main.ml also)
*)
then
gnuplot_oc
:=
Util2
.
gnuplotrif_dyn
(
args
.
verbose
>
1
)
args
.
output
;
loop
(
check_oracles
oracle_in_vals
i
oracle_out_l
oracle_out_vals_l
cov
)
...
...
source/Lutin/main.ml
View file @
874bebce
...
...
@@ -256,7 +256,6 @@ let to_exe oc infile mnode opt = (
let
rec
do_step
cpt
ctrl
ins
pres
=
(
Verbose
.
put
"#Main.to_exe: step %d
\n
"
cpt
;
let
bg
=
LutExe
.
get_behavior_gen
exe
ins
pres
ctrl
in
match
bg
()
with
|
LutExe
.
NoMoreBehavior
->
(
...
...
@@ -287,6 +286,13 @@ let to_exe oc infile mnode opt = (
);
Rif
.
write
oc
"
\n
"
;
Rif
.
flush
oc
;
(
match
call_gnuplot
opt
,
riffile
opt
with
|
true
,
Some
file
->
if
cpt
=
1
then
ignore
(
Util2
.
gnuplotrif_dyn
(
Verbose
.
level
()
>
1
)
file
)
else
if
cpt
>
1
then
Util2
.
gnuplotrif_update
(
Verbose
.
level
()
>
1
)
file
;
|
_
,_
->
()
);
(* prepare next step *)
if
do_stop
cpt
then
(
if
noo
then
(
...
...
@@ -318,9 +324,10 @@ let to_exe oc infile mnode opt = (
exit
0
)
)
)
in
)
in
let
seed
=
MainArg
.
seed
opt
in
let
msg
=
Printf
.
sprintf
"# This is lutin Version %s (%s)
\n
# The random engine was initialized with the seed %d
\n
"
...
...
source/Lutin/mainArg.ml
View file @
874bebce
...
...
@@ -42,6 +42,8 @@ type t = {
mutable
_outfile
:
string
option
;
mutable
_riffile
:
string
option
;
mutable
_only_outputs
:
bool
;
mutable
_call_gnuplot
:
bool
;
}
let
(
make_opt
:
unit
->
t
)
=
...
...
@@ -73,6 +75,7 @@ let (make_opt : unit -> t) =
_outfile
=
None
;
_riffile
=
None
;
_only_outputs
=
false
;
_call_gnuplot
=
false
;
}
...
...
@@ -109,6 +112,7 @@ let load_mem opt = opt._load_mem
let
outfile
opt
=
opt
._
outfile
let
outpipe
opt
=
opt
._
outpipe
let
riffile
opt
=
opt
._
riffile
let
call_gnuplot
opt
=
opt
._
call_gnuplot
let
only_outputs
opt
=
opt
._
only_outputs
let
show_locals
opt
=
opt
._
show_locals
let
set_show_locals
opt
b
=
opt
._
show_locals
<-
b
...
...
@@ -120,7 +124,6 @@ let set_compute_volume opt b = opt._compute_volume <- b
let
pspec
os
opt
(
c
,
ml
)
=
(
let
(
m1
,
oth
)
=
match
ml
with
|
h
::
t
->
(
h
,
t
)
...
...
@@ -246,10 +249,16 @@ let (mkoptab : t -> unit) =
(
Arg
.
Unit
(
function
s
->
opt
._
outpipe
<-
true
))
[
"with -luc: write to stdout"
]
;
mkopt
opt
[
"-gnuplot"
;
"-gp"
]
(
Arg
.
Unit
(
function
s
->
opt
._
call_gnuplot
<-
true
))
[
"call gnuplot-rif to display data (type 'a' in the gnuplot window to refresh it)."
^
" Requires -rif to be used."
]
;
mkopt
opt
[
"-quiet"
;
"-q"
;
"-only-outputs"
]
(
Arg
.
Unit
(
function
s
->
opt
._
only_outputs
<-
true
))
[
"display only outputs on stdout (no #step, #outs, etc."
]
[
"display only outputs on stdout (no #step, #outs, etc.
)
"
]
;
mkopt
opt
[
"-rif"
]
...
...
source/Lutin/mainArg.mli
View file @
874bebce
...
...
@@ -51,6 +51,8 @@ val outpipe : t -> bool
(* Rif *)
val
riffile
:
t
->
string
option
val
call_gnuplot
:
t
->
bool
val
only_outputs
:
t
->
bool
val
show_locals
:
t
->
bool
...
...
source/common/util2.ml
View file @
874bebce
...
...
@@ -15,6 +15,15 @@ let mygetenv x =
try
Unix
.
getenv
x
with
Not_found
->
x
^
" env var not defined"
let
mygetenv_def
def
x
=
let
x
=
match
Sys
.
os_type
with
|
"Win32"
->
(
x
^
"_DOS"
)
|
_
->
x
in
try
Unix
.
getenv
x
with
Not_found
->
def
(** [ps2pdf ps_file] calls the post-script visualizer [ps2pdf] on [ps_file]. *)
let
(
ps2pdf
:
string
->
unit
)
=
fun
pdf_file
->
...
...
@@ -297,7 +306,7 @@ let (lv62ec: string -> string -> string -> bool) =
let
(
gnuplotrif_update
:
bool
->
string
->
unit
)
=
fun
verb
riffile
->
let
gnuplotrif
=
mygetenv
"GNUPLOTRIF"
in
let
gnuplotrif
=
mygetenv
_def
"gnuplot-rif"
"GNUPLOTRIF"
in
let
cmd
=
(
gnuplotrif
^
" -no-display "
^
riffile
)
in
let
cmd
=
if
verb
then
cmd
^
" -verbose"
else
cmd
in
let
res
=
Sys
.
command
cmd
in
...
...
@@ -309,7 +318,7 @@ let (gnuplotrif_update : bool -> string -> unit) =
let
(
gnuplotrif_dyn
:
bool
->
string
->
out_channel
)
=
fun
verb
riffile
->
let
_
=
gnuplotrif_update
verb
riffile
in
let
gnuplot
=
mygetenv
"GNUPLOT"
in
let
gnuplot
=
mygetenv
_def
"gnuplot"
"GNUPLOT"
in
let
plotfile
=
(
Filename
.
chop_extension
riffile
)
^
".plot"
in
let
cmd
=
gnuplot
^
"
\"
"
^
plotfile
^
"
\"
"
in
let
oc
=
Unix
.
open_process_out
cmd
in
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment