Commit 47f12787 authored by erwan's avatar erwan
Browse files

Update: take advantage of the new rdbg mv_hook Exit event for more robustness

parent 229c1479
Pipeline #67033 passed with stages
in 4 minutes and 19 seconds
......@@ -23,7 +23,7 @@ depends: [
"dune" { >= "1.11" }
"ocamlgraph"
"lutils"
"rdbg" { >= "1.193.1" }
"rdbg" { >= "1.194" }
]
depopts: [
"lustre-v6"
......
(* Time-stamp: <modified the 11/05/2021 (at 18:19) by Erwan Jahier> *)
(* Time-stamp: <modified the 14/05/2021 (at 15:40) by Erwan Jahier> *)
#thread
#require "lablgtk3"
......@@ -69,16 +69,23 @@ let daemongui_activate = Hashtbl.create 1
let (fake_val_of_type : Data.t -> Data.v) = function
| Bool -> B false
| Int -> I 0
| Real -> F 0.0
| Extern _
| Enum _
| Struct _
| Array _
| Alpha _
| Alias _
| Int -> I (Random.int 10)
| Real -> F (Random.float 10.0)
| Extern _ -> assert false
| Enum _ -> assert false
| Struct _ -> assert false
| Array _ -> assert false
| Alpha _ -> assert false
| Alias _ -> assert false
| String _ -> assert false
(* *)
let goto_hook_call () =
e := next_cond !e (fun e -> e.name = "mv_hook" && e.kind = Call)
let goto_hook_exit () =
e := next_cond !e (fun e -> e.name = "mv_hook" && e.kind = Exit)
let init_rdbg_hook () =
let guidaemon sl =
if sl = [] then
......@@ -144,9 +151,12 @@ let custom_daemon p gtext vbox step_button round_button =
set_tooltip dk_manual (Printf.sprintf "Set the manual mode");
set_tooltip dk_manual_central (Printf.sprintf "Set the manual central mode");
(* Necessary for pour salut *)
if args.salut_mode then e:= next_cond !e (fun e -> e.kind = Ltop);
(* if !e.kind <> Exit then e := next_cond !e (fun e -> e.kind = Exit && e.depth = 2); *)
(* Necessary for salut (to perform a fake step that let sasa provide
the first set of enables) *)
if args.salut_mode then (
goto_hook_call ();goto_hook_call ();
d()
);
let nodes_enabled = rdbg_nodes_enabled !e in
(** Met à jour le hook pour node quand le bouton ou une checkbox correspondant est activé *)
......@@ -233,7 +243,8 @@ let custom_daemon p gtext vbox step_button round_button =
ignore(pushbox#event#connect#button_press
~callback: (fun _ ->
update_rdbg_hook name true;
sd();
goto_hook_call ();
goto_hook_call ();
refresh ();
false));
Hashtbl.add pushbox_map name pushbox
......@@ -348,9 +359,6 @@ let custom_daemon p gtext vbox step_button round_button =
aux 0 [] nl
in
let step () =
let ne = if !e.name = "mv_hook" then
next_cond !e (fun e -> e.name = "mv_hook") else !e in
e:=ne;
let nodes_enabled = rdbg_nodes_enabled !e in
let nodes = List.filter (fun (_,b) -> b) nodes_enabled in
let nodes = get_higher_prioriry nodes in
......@@ -361,19 +369,19 @@ let custom_daemon p gtext vbox step_button round_button =
let to_activate = Daemon.distributed nodes in
Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_activate;
e:=next_cond !e (fun e -> e.kind = Ltop); d ();
goto_hook_exit (); goto_hook_call (); d ()
)
| Synchronous -> (
Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) nodes;
e:=next_cond !e (fun e -> e.kind = Ltop); d ();
goto_hook_exit (); goto_hook_call (); d ()
)
| Central -> (
let nodes = List.map (fun x -> [x]) nodes in
let to_activate = Daemon.central nodes in
Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_activate;
e:=next_cond !e (fun e -> e.kind = Ltop); d ();
goto_hook_exit (); goto_hook_call (); d ()
)
| LocCentral -> (
let get_neigbors x =
......@@ -387,10 +395,10 @@ let custom_daemon p gtext vbox step_button round_button =
let to_activate = Daemon.locally_central nodes in
Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_activate;
e:=next_cond !e (fun e -> e.kind = Ltop); d ();
goto_hook_exit (); goto_hook_call (); d ()
)
| ManualCentral -> () (* SNO *)
| Manual -> e:=next_cond !e (fun e -> e.kind = Ltop); d ()
| ManualCentral -> () (* SNO; the step is done in pushbox callbacks *)
| Manual -> goto_hook_exit (); goto_hook_call (); d ()
in
step
......@@ -550,7 +558,12 @@ let main () =
(button_cb
(fun ()->
r();
if args.salut_mode then e:= next_cond !e (fun e -> e.kind = Ltop);
if args.salut_mode then
(* in this mode, the hook plays first to provide fake values to sasa
but the hook does not need input at this first step
*)
goto_hook_call ();
goto_hook_call ();
d()))
in
let _ = make_button `MEDIA_PLAY "_Sim2chro" "Launch sim2chro on the generated data (so far)"
......
Supports Markdown
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