diff --git a/tools/rdbg4sasa/gtkgui.ml b/tools/rdbg4sasa/gtkgui.ml index 3b9f5a016ac85b1f7765785d7ff0c973cfd9c985..0a0b783dc973d6052533ccfa2371db515b7f8dec 100644 --- a/tools/rdbg4sasa/gtkgui.ml +++ b/tools/rdbg4sasa/gtkgui.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 07/05/2021 (at 17:28) by Erwan Jahier> *) +(* Time-stamp: <modified the 08/05/2021 (at 10:33) by Erwan Jahier> *) #thread #require "lablgtk3" @@ -49,7 +49,7 @@ let rdbg_nodes_enabled e = ((node, enab), []) l in - List.rev (last::res) + last::res type daemon_kind = Distributed | Synchronous | Central | LocCentral | ManualCentral | Manual @@ -310,21 +310,26 @@ let custom_daemon p gtext vbox step_button round_button = aux 0 [] nl in let step () = + let ne = if !e.kind <> Exit && !e.lang <> "sasa" then + next_cond !e (fun e -> e.kind = Exit && e.lang = "sasa") 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 + (* p ("==> gtkgui: CALL =" ^ (string_of_event !e)); *) match !daemon_kind with | Distributed -> let nodes = List.map (fun x -> [x]) nodes in let to_activate = Daemon.distributed nodes in Hashtbl.clear daemongui_activate; List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_activate; - sd (); + e:=next_cond !e (fun e -> e.kind = Ltop); d (); p ("Distributed step : " ^ (String.concat "," to_activate)) | Synchronous -> ( Hashtbl.clear daemongui_activate; List.iter (fun n -> Hashtbl.replace daemongui_activate n true) nodes; - sd (); + e:=next_cond !e (fun e -> e.kind = Ltop); d (); + p ("==> gtkgui: EXIT =" ^ (string_of_event !e)); p ("Synchronous step : " ^ (String.concat "," nodes)) ) | Central -> @@ -332,7 +337,7 @@ let custom_daemon p gtext vbox step_button round_button = let to_activate = Daemon.central nodes in Hashtbl.clear daemongui_activate; List.iter (fun n -> Hashtbl.replace daemongui_activate n true) to_activate; - sd (); + e:=next_cond !e (fun e -> e.kind = Ltop); d (); p ("Central step : " ^ (String.concat "," to_activate)) | LocCentral -> @@ -347,11 +352,11 @@ 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; - sd (); + e:=next_cond !e (fun e -> e.kind = Ltop); d (); p "Locally central step: finish me" | ManualCentral -> () (* SNO *) - | Manual -> sd () + | Manual -> e:=next_cond !e (fun e -> e.kind = Ltop); d () in step @@ -390,7 +395,6 @@ let main () = in let p str = text_out#set_buffer (GText.buffer ~text:str ()); - Printf.fprintf oc_stdin "%s\n%!" str; Printf.printf "%s\n%!" str; in (* It should be better to rely on the gtk event handler