Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
Pipeline #67033 passed
...@@ -23,7 +23,7 @@ depends: [ ...@@ -23,7 +23,7 @@ depends: [
"dune" { >= "1.11" } "dune" { >= "1.11" }
"ocamlgraph" "ocamlgraph"
"lutils" "lutils"
"rdbg" { >= "1.193.1" } "rdbg" { >= "1.194" }
] ]
depopts: [ depopts: [
"lustre-v6" "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 #thread
#require "lablgtk3" #require "lablgtk3"
...@@ -69,16 +69,23 @@ let daemongui_activate = Hashtbl.create 1 ...@@ -69,16 +69,23 @@ let daemongui_activate = Hashtbl.create 1
let (fake_val_of_type : Data.t -> Data.v) = function let (fake_val_of_type : Data.t -> Data.v) = function
| Bool -> B false | Bool -> B false
| Int -> I 0 | Int -> I (Random.int 10)
| Real -> F 0.0 | Real -> F (Random.float 10.0)
| Extern _ | Extern _ -> assert false
| Enum _ | Enum _ -> assert false
| Struct _ | Struct _ -> assert false
| Array _ | Array _ -> assert false
| Alpha _ | Alpha _ -> assert false
| Alias _ | Alias _ -> assert false
| String _ -> 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 init_rdbg_hook () =
let guidaemon sl = let guidaemon sl =
if sl = [] then if sl = [] then
...@@ -144,9 +151,12 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -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 (Printf.sprintf "Set the manual mode");
set_tooltip dk_manual_central (Printf.sprintf "Set the manual central mode"); set_tooltip dk_manual_central (Printf.sprintf "Set the manual central mode");
(* Necessary for pour salut *) (* Necessary for salut (to perform a fake step that let sasa provide
if args.salut_mode then e:= next_cond !e (fun e -> e.kind = Ltop); the first set of enables) *)
(* if !e.kind <> Exit then e := next_cond !e (fun e -> e.kind = Exit && e.depth = 2); *) if args.salut_mode then (
goto_hook_call ();goto_hook_call ();
d()
);
let nodes_enabled = rdbg_nodes_enabled !e in let nodes_enabled = rdbg_nodes_enabled !e in
(** Met à jour le hook pour node quand le bouton ou une checkbox correspondant est activé *) (** 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 = ...@@ -233,7 +243,8 @@ let custom_daemon p gtext vbox step_button round_button =
ignore(pushbox#event#connect#button_press ignore(pushbox#event#connect#button_press
~callback: (fun _ -> ~callback: (fun _ ->
update_rdbg_hook name true; update_rdbg_hook name true;
sd(); goto_hook_call ();
goto_hook_call ();
refresh (); refresh ();
false)); false));
Hashtbl.add pushbox_map name pushbox Hashtbl.add pushbox_map name pushbox
...@@ -348,9 +359,6 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -348,9 +359,6 @@ let custom_daemon p gtext vbox step_button round_button =
aux 0 [] nl aux 0 [] nl
in in
let step () = 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_enabled = rdbg_nodes_enabled !e in
let nodes = List.filter (fun (_,b) -> b) nodes_enabled in let nodes = List.filter (fun (_,b) -> b) nodes_enabled in
let nodes = get_higher_prioriry nodes in let nodes = get_higher_prioriry nodes in
...@@ -361,19 +369,19 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -361,19 +369,19 @@ let custom_daemon p gtext vbox step_button round_button =
let to_activate = Daemon.distributed nodes in let to_activate = Daemon.distributed nodes in
Hashtbl.clear daemongui_activate; Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_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 -> ( | Synchronous -> (
Hashtbl.clear daemongui_activate; Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) nodes; 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 -> ( | Central -> (
let nodes = List.map (fun x -> [x]) nodes in let nodes = List.map (fun x -> [x]) nodes in
let to_activate = Daemon.central nodes in let to_activate = Daemon.central nodes in
Hashtbl.clear daemongui_activate; Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_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 -> ( | LocCentral -> (
let get_neigbors x = let get_neigbors x =
...@@ -387,10 +395,10 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -387,10 +395,10 @@ let custom_daemon p gtext vbox step_button round_button =
let to_activate = Daemon.locally_central nodes in let to_activate = Daemon.locally_central nodes in
Hashtbl.clear daemongui_activate; Hashtbl.clear daemongui_activate;
List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_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 *) | ManualCentral -> () (* SNO; the step is done in pushbox callbacks *)
| Manual -> e:=next_cond !e (fun e -> e.kind = Ltop); d () | Manual -> goto_hook_exit (); goto_hook_call (); d ()
in in
step step
...@@ -550,7 +558,12 @@ let main () = ...@@ -550,7 +558,12 @@ let main () =
(button_cb (button_cb
(fun ()-> (fun ()->
r(); 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())) d()))
in in
let _ = make_button `MEDIA_PLAY "_Sim2chro" "Launch sim2chro on the generated data (so far)" let _ = make_button `MEDIA_PLAY "_Sim2chro" "Launch sim2chro on the generated data (so far)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment