diff --git a/lib/sasa/sasaRun.ml b/lib/sasa/sasaRun.ml index 5b2301cf6e2c5fdbd25f47ea5aded2845795b5b0..ba2f0be633aa36f1ace3f9696b6f0a16a68e1372 100644 --- a/lib/sasa/sasaRun.ml +++ b/lib/sasa/sasaRun.ml @@ -79,7 +79,8 @@ let (make_do: string array -> 'v SimuState.t -> RdbgPlugin.t) = let sasa_config = ref st.config in let reset () = pre_enable_processes_opt := None; - sasa_config := st.config + sasa_config := + (Sasacore.SimuState.make false argv).config (* to take seed changes into account *) in (* Do the same job as SasaSimuState.simustep *) let (step_custom: RdbgPlugin.sl -> RdbgPlugin.sl) = diff --git a/tools/rdbg4sasa/gtkgui.ml b/tools/rdbg4sasa/gtkgui.ml index 006cd0c69ae9a6a828a15e71382d086d82ff85be..b15413b1498ff9343249324434bee64723b3de76 100644 --- a/tools/rdbg4sasa/gtkgui.ml +++ b/tools/rdbg4sasa/gtkgui.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 19/05/2021 (at 17:04) by Erwan Jahier> *) +(* Time-stamp: <modified the 22/05/2021 (at 21:21) by Erwan Jahier> *) #thread #require "lablgtk3" @@ -91,7 +91,12 @@ let init_rdbg_hook () = if sl = [] then (* when called first (salut), its activation output will be ignored, so we can give fake values for Enab ans state values *) - let res = List.map (fun (n,t) -> n, fake_val_of_type t) (snd !rdbg_mv) in + let res = List.map (fun (n,t) -> + let v = fake_val_of_type t in + (* Printf.printf "tossing a value for %s -> %s \n%!" n *) + (* (Data.val_to_string string_of_float v); *) + n, v) (snd !rdbg_mv) + in Some res else let sl = List.filter (fun (n,v) -> String.length n > 5 && String.sub n 0 5 = "Enab_") sl in @@ -243,7 +248,7 @@ let custom_daemon p gtext vbox step_button round_button = ignore(pushbox#event#connect#button_press ~callback: (fun _ -> update_rdbg_hook name true; - goto_hook_call (); + goto_hook_exit (); goto_hook_call (); refresh (); false)); @@ -560,20 +565,40 @@ let main () = let _ = make_button `REFRESH "Restar_t" "Restart from the beginning" (button_cb (fun ()-> + let seed = Seed.get dotfile in + Seed.set seed; + p (Printf.sprintf "Restarting using the seed %d" seed); r(); 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_exit (); + goto_hook_call (); + d())) + in + let _ = make_button `REFRESH "_New Seed" "Restart from the beginning using a New Seed" + (button_cb + (fun ()-> + Seed.reset(); + Seed.replay_seed := false; + let seed = Seed.get dotfile in + Seed.set (seed); + p (Printf.sprintf "Restarting using the seed %d" seed); + r(); + 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_exit (); goto_hook_call (); d())) in let _ = make_button `MEDIA_PLAY "_Sim2chro" "Launch sim2chro on the generated data (so far)" - (button_cb (fun ()->sim2chro ())) + (button_cb sim2chro) in let _ = make_button `MEDIA_PLAY "_Gnuplot" "Launch gnuplot-rif on the generated data (so far)" - (button_cb (fun ()->gnuplot ())) + (button_cb gnuplot) in let _ = make_button `INFO "_Info" "Get information about the current session" (button_cb_string info_string) @@ -654,7 +679,8 @@ let main () = quit (); (* quit rdbg, this will stop the readloop below *) Main.quit () (* terminate gtk *) )); - + Seed.replay_seed := true; + ignore(Seed.get dotfile); refresh () let gui = main