Commit ceaf4c74 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

fix web

parent 1486e078
Pipeline #1684 passed with stages
in 31 seconds
......@@ -68,7 +68,7 @@ let outfilename = ref (None: string option)
let nbtraj = ref 10
let verbose = ref 1
let splitting_debug = ref ""
let out_style = ref OutFormat.Timestamp
let out_style = ref OutFormat.Timeword
let store_traj = ref false
let print_rg = ref false
let sampler = ref Low_disc_sampler.random
......@@ -95,20 +95,6 @@ let spec_short = [
(*"-o", Arg.String (fun s -> outfile := Format.formatter_of_out_channel @@ open_out s), "Output file for trajectories";*)
"--template", Set_string template, "specify a template for time words; template look like '0.2[a]_[b]'";
"--max-iteration", Int (max_iteration,20) , "Number of iteration for Newton method";
"--sampler", Symbol (module struct
type t = int -> int -> float
let list = ["random"; "halton";"kronecker"]
let content = sampler
let def = Low_disc_sampler.random
let to_string = function
f when f=Low_disc_sampler.halton -> "halton"
| f when f=Low_disc_sampler.kronecker_phi -> "kronecker"
| _ -> "random"
let of_string = function
"halton" -> Low_disc_sampler.halton
| "kronecker" -> Low_disc_sampler.kronecker_phi
| _ -> Low_disc_sampler.random
end), " choose sampler (default random)";
"--output-format",Symbol (module struct
type t = OutFormat.output_style
let list = OutFormat.style_list
......@@ -127,7 +113,21 @@ let spec_full =
spec_short @ [
"--gnuplot-driver", Set_string gnuplot_driver, "launch gnuplot";
"--export-splitreach", Set_string export_zone_graph, "Export the splitted zone graph";
"--splitting-debug", String (splitting_debug,"") , "Export debug information on the splitting in tex format"
"--splitting-debug", String (splitting_debug,"") , "Export debug information on the splitting in tex format";
"--sampler", Symbol (module struct
type t = int -> int -> float
let list = ["random"; "halton";"kronecker"]
let content = sampler
let def = Low_disc_sampler.random
let to_string = function
f when f=Low_disc_sampler.halton -> "halton"
| f when f=Low_disc_sampler.kronecker_phi -> "kronecker"
| _ -> "random"
let of_string = function
"halton" -> Low_disc_sampler.halton
| "kronecker" -> Low_disc_sampler.kronecker_phi
| _ -> Low_disc_sampler.random
end), " choose sampler (default random)"
]
let post_parse () =
......
......@@ -2,34 +2,47 @@ open Html
open Js_of_ocaml
let build_interface_elem up (opt,x,help) =
let open Arg in
let open Arguments in
let input = match x with
Set a -> checkbox_input ~on_change:(fun x -> a:=x;up ()) !a
| Clear a -> checkbox_input ~on_change:(fun x -> a:=x;up ()) !a
| Bool f -> checkbox_input ~on_change:(fun x -> f x;up ()) false
| Set_int a -> text_input ~_type:"number" ~on_change:(fun x -> a:=int_of_string x;up ()) (string_of_int !a)
| Int f -> text_input ~_type:"number" ~on_change:(fun x -> f (int_of_string x);up ()) "3"
| Float f -> text_input ~_type:"text" ~on_change:(fun x -> f (float_of_string x);up ()) "0.0"
| Set_float a -> text_input ~_type:"text" ~on_change:(fun x -> a:= (float_of_string x);up ()) (string_of_float !a)
| String f -> text_input ~_type:"text" ~on_change:(fun x -> f x;up ()) ""
| Set_string a -> text_input ~_type:"text" ~on_change:(fun x -> a:= x;up ()) (!a)
| Symbol (l,f) -> select l ~on_change:(fun x -> f x;up ())
| Unit f -> checkbox_input ~on_change:(fun x -> if x then f ();up ()) false
| Tuple _ | Rest _ | Expand _ ->
failwith "Not Implemented"
| Bool f -> checkbox_input ~on_change:(fun x -> f:= x;up ()) false
| Set_int a -> text_input ~_type:"number" ~on_change:(fun x -> a:= Some (int_of_string x);up ()) ("")
| Int (f,df) -> text_input ~_type:"number" ~on_change:(fun x -> f:= (int_of_string x);up ()) (string_of_int df)
| Set_float (a) -> text_input ~_type:"text" ~on_change:(fun x -> a := Some (float_of_string x);up ()) ""
| Float (f,df) -> text_input ~_type:"text" ~on_change:(fun x -> f:= (float_of_string x);up ()) (string_of_float df)
| Set_string f -> text_input ~_type:"text" ~on_change:(fun x -> f := Some x;up ()) ""
| String (a,ds) -> text_input ~_type:"text" ~on_change:(fun x -> a:= x;up ()) ds
| Symbol s ->
let module S = (val s : SYM) in
select S.list ~on_change:(fun x -> S.content := S.of_string x;up ())
in
div ~class_:"cmdelem" ~title:help [text opt; text " : "; input ]
let build_cmd_elem (opt,x,help) =
let open Arg in
let open Arguments in
match x with
Set a when !a -> " "^opt
| Clear a when not !a -> " "^opt
| Set_string a -> Printf.sprintf " %s %s" opt !a
| Set_float a -> Printf.sprintf " %s %g" opt !a
| Set_int a -> Printf.sprintf " %s %i" opt !a
| _ -> ""
Bool a when !a -> " "^opt
| Bool _ -> ""
| Set_string a -> (match !a with
Some v -> Printf.sprintf " %s %s" opt v
| None -> "")
| String (s,ds) -> if !s = ds then ""
else Printf.sprintf " %s %s" opt !s
| Set_float a -> (match !a with
Some v -> Printf.sprintf " %s %g" opt v
| None -> "")
| Float (s,ds) -> if !s = ds then ""
else Printf.sprintf " %s %g" opt !s
| Set_int a -> (match !a with
Some v -> Printf.sprintf " %s %i" opt v
| None -> "")
| Int (s,ds) -> if !s = ds then ""
else Printf.sprintf " %s %i" opt !s
| Symbol s ->
let module S = (val s:SYM) in
if !(S.content) = S.def then ""
else Printf.sprintf " %s %s" opt (S.to_string !(S.content))
let build_cmd l =
let str = List.fold_left (fun acc elem -> acc ^ (build_cmd_elem elem)) "wordgen" l in
str ^" automata.prism"
......@@ -111,6 +124,7 @@ let _ = run @@ fun () ->
print_endline ("Computation finished")
);Js._true));
let launch_compt b =
Arguments.post_parse ();
stdoutput_up "";
outfile_up "";
sig_up [];
......
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