diff --git a/sasa.opam b/sasa.opam index 2b89ccf49b4a9c5c77d71d05410ab0ea03e310e8..c98f47b2a7fcf5cf5154faf5bb2bac81536cd8b8 100644 --- a/sasa.opam +++ b/sasa.opam @@ -23,7 +23,7 @@ depends: [ "dune" { >= "1.11" } "ocamlgraph" "lutils" - "rdbg" { >= "1.193.1" } + "rdbg" { >= "1.194" } ] depopts: [ "lustre-v6" diff --git a/tools/rdbg4sasa/gtkgui.ml b/tools/rdbg4sasa/gtkgui.ml index 4e0b61c25cc165c4886ca98e7f8015ceb5370b26..7afb6cf59550d86bc8070fa92e0db411dac4a5c0 100644 --- a/tools/rdbg4sasa/gtkgui.ml +++ b/tools/rdbg4sasa/gtkgui.ml @@ -1,4 +1,4 @@ -(* 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)"