Commit c24817c8 authored by erwan's avatar erwan
Browse files

Update: take advantage of the new mv_hook event (rdbg 1.191) to be more general

parent 7c662175
Pipeline #66641 passed with stages
in 3 minutes and 49 seconds
......@@ -23,7 +23,7 @@ depends: [
"dune" { >= "1.11" }
"ocamlgraph"
"lutils"
"rdbg" { >= "1.190" }
"rdbg" { >= "1.191" }
]
depopts: [
"lustre-v6"
......
(* Time-stamp: <modified the 08/05/2021 (at 10:33) by Erwan Jahier> *)
(* Time-stamp: <modified the 09/05/2021 (at 11:22) by Erwan Jahier> *)
#thread
#require "lablgtk3"
......@@ -310,51 +310,47 @@ 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
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
(* 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;
e:=next_cond !e (fun e -> e.kind = Ltop); d ();
p ("Distributed step : " ^ (String.concat "," to_activate))
| 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;
e:=next_cond !e (fun e -> e.kind = Ltop); 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 ();
p ("==> gtkgui: EXIT =" ^ (string_of_event !e));
p ("Synchronous step : " ^ (String.concat "," nodes))
)
| 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 ();
p ("Central step : " ^ (String.concat "," to_activate))
| LocCentral ->
let get_neigbors x =
let succ = snd (List.split (topology.succ x)) in
let pred = topology.pred x in
let res = List.fold_left (fun acc x -> if List.mem x acc then acc else x::acc) succ pred in
(* p (Printf.sprintf "voisins(%s)=%s\n" x (String.concat "," res)); *)
res
in
let nodes = List.map (fun x -> [x, get_neigbors x]) nodes in
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 ();
p "Locally central step: finish me"
| 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 ();
)
| LocCentral -> (
let get_neigbors x =
let succ = snd (List.split (topology.succ x)) in
let pred = topology.pred x in
let res = List.fold_left (fun acc x -> if List.mem x acc then acc else x::acc) succ pred in
(* p (Printf.sprintf "voisins(%s)=%s\n" x (String.concat "," res)); *)
res
in
let nodes = List.map (fun x -> [x, get_neigbors x]) nodes in
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 ();
)
| ManualCentral -> () (* SNO *)
| Manual -> e:=next_cond !e (fun e -> e.kind = Ltop); d ()
in
......
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