Commit a0e1f4c3 authored by erwan's avatar erwan
Browse files

Update: minors changes

parent b9832611
(* Time-stamp: <modified the 04/04/2019 (at 21:27) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/05/2019 (at 14:45) by Erwan Jahier> *)
type ident = string
type v = I of int | F of float | B of bool
......@@ -27,7 +27,7 @@ let rec (val_to_string_type : v -> string) =
let rec (val_to_string : (float -> string) -> v -> string) =
fun s2f ->
function
| I i -> string_of_int i
| I i -> (try string_of_int i with _ -> assert false)
| F f -> s2f f
| B true -> "t"
| B false -> "f"
......@@ -44,7 +44,7 @@ let rec (val_to_string : (float -> string) -> v -> string) =
let rec (val_to_rif_string : (float -> string) -> v -> string) =
fun s2f ->
function
| I i -> string_of_int i
| I i -> (try string_of_int i with _ -> assert false)
| F f -> s2f f
| B true -> "t"
| B false -> "f"
......
(* Time-stamp: <modified the 01/02/2019 (at 10:45) by Erwan Jahier> *)
(* Time-stamp: <modified the 27/05/2019 (at 14:03) by Erwan Jahier> *)
(*-----------------------------------------------------------------------
** This file may only be copied under the terms of the CeCill
** Public License
......@@ -250,26 +250,27 @@ let gen_gnuplot_file vars to_hide ttbl file tk =
let var_tbl_str = String.concat ", " (List.map (fun (n,_) -> n) ttbl) in
output_string stderr
("Warning: cannot find "^var^" in "^var_tbl_str^"\n");
flush stderr;
false,false (* fake values *)
flush stderr;
false,false (* fake values *)
in
put ("\"< read-rif.sh "^ !rif_file^ " ");
if !dynamic then put (" | tail -n "^ (string_of_int !window_size)) else
(match !min_step,!max_step with
| None, None -> ()
| Some l, None -> put (" | tail -n +"^ (string_of_int l))
| None, Some h -> put (" | head -n "^ (string_of_int h))
| Some l, Some h -> put (" | head -n "^ (string_of_int h) ^
" | tail -n +"^(string_of_int l))
| None, None -> ()
| Some l, None -> put (" | tail -n +"^ (string_of_int l))
| None, Some h -> put (" | head -n "^ (string_of_int h))
| Some l, Some h -> put (" | head -n "^ (string_of_int h) ^
" | tail -n +"^(string_of_int l))
);
put ("\" using 1:" ^
(if is_num then
("(getminmax($"^(string_of_int i)^")) title \"" ^ var ^ "\" with linespoints")
else
("(scale_bool($"^(string_of_int i)^","^
(incr bool_var_nb;string_of_int (!bool_var_nb-1))^")) lc rgb \""^(if is_input then "blue" else "red")^"\" notitle")
)
)
(if is_num then
("(getminmax($"^(string_of_int i)^")) title \""^var^"\" with linespoints")
else
("(scale_bool($"^(string_of_int i)^","^
(incr bool_var_nb;string_of_int (!bool_var_nb-1))^")) lc rgb \""^
(if is_input then "blue" else "red")^"\" notitle")
)
)
in
let bool_nb =
List.fold_left
......@@ -294,8 +295,9 @@ set grid back";
put ("
set mouse
" ^
(if num_nb = 0 then "" else "set key outside title \"Numeric variables\" box 3")^
"
(if num_nb = 0 then "" else
"set key outside title \"Numeric variables\" box 3")^
"
set xlabel \"steps\"
# Set parameters
......@@ -315,27 +317,27 @@ scale_bool(x,i) = min + 1.7*i*delta + (x*delta)
label_pos(i)=min + i*delta*1.7+delta*0.5
"^(if !dynamic then ("set xtics " ^ (string_of_int (!window_size / 10))) else
match !min_step,!max_step with
| None, None -> ""
| Some l, None -> ""
| None, Some h -> "set xtics " ^ (string_of_int (h / 10))
| Some l, Some h ->"set xtics " ^ (string_of_int ((h-l) / 10))
)^"\n");
match !min_step,!max_step with
| None, None -> ""
| Some l, None -> ""
| None, Some h -> "set xtics " ^ (string_of_int (h / 10))
| Some l, Some h ->"set xtics " ^ (string_of_int ((h-l) / 10))
)^"\n");
put (terminal_kind_to_string tk file);
put "\nplot ";
ignore
(List.fold_left
(fun (i,sep) var ->
if to_hide var then (
if !verbose then
print_string ("\n Skipping hidden var "^var) ;
(i+1,sep)
)
else (
put sep;
put_one_var var i;
(i+1,", \\\n ")
)
if to_hide var then (
if !verbose then
print_string ("\n Skipping hidden var "^var) ;
(i+1,sep)
)
else (
put sep;
put_one_var var i;
(i+1,", \\\n ")
)
)
(2,"")
vars
......@@ -344,14 +346,14 @@ label_pos(i)=min + i*delta*1.7+delta*0.5
bool_var_nb:=0;
List.iter
(fun (id, (t,pos,ii)) ->
if (to_hide id) then debug_msg ("Hidding " ^ id ^ "\n");
if t = "bool" then (
if (to_hide id) then () else (
put ("set label \""^ id ^ "\" at 3, (label_pos("^
(incr bool_var_nb;string_of_int (!bool_var_nb-1))
^")) front left \n")
)
) ;
if (to_hide id) then debug_msg ("Hidding " ^ id ^ "\n");
if t = "bool" then (
if (to_hide id) then () else (
put ("set label \""^ id ^ "\" at 3, (label_pos("^
(incr bool_var_nb;string_of_int (!bool_var_nb-1))
^")) front left \n")
)
) ;
)
ttbl;
put "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment