diff --git a/lib/sasacore/demon.ml b/lib/sasacore/demon.ml index f479bbcae04bb942314e65bd306a41c96cefa771..618a8b07ae1fa1f52b623dee50f5aba4f57f695b 100644 --- a/lib/sasacore/demon.ml +++ b/lib/sasacore/demon.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 13/03/2019 (at 17:44) by Erwan Jahier> *) +(* Time-stamp: <modified the 28/03/2019 (at 18:01) by Erwan Jahier> *) type t = | Synchronous (* select all actions *) @@ -79,9 +79,11 @@ let (remove_empty_list: 'a list list -> 'a list list) = fun ll -> List.filter (fun l -> l<>[]) ll -let (f: bool -> t -> Process.t list -> pna list list -> bool list list -> +let (f: bool -> bool -> t -> Process.t list -> pna list list -> bool list list -> string * pna list) = - fun verbose_mode demon pl all enab -> + fun dummy_input verbose_mode demon pl all enab -> + if demon <> Custom && dummy_input then + ignore (RifRead.bool verbose_mode (List.hd pl) ""); match demon with | Synchronous -> "", synchrone (remove_empty_list all) | Central -> "", random1 (remove_empty_list all) diff --git a/lib/sasacore/demon.mli b/lib/sasacore/demon.mli index ce5516b0e5ae5a417ea859690734861f09d703e3..6d0d74f0ee2a72a5e4774b66507a3f1efdefdcde 100644 --- a/lib/sasacore/demon.mli +++ b/lib/sasacore/demon.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 12/03/2019 (at 17:34) by Erwan Jahier> *) +(* Time-stamp: <modified the 28/03/2019 (at 18:01) by Erwan Jahier> *) type t = | Synchronous (* select all actions *) @@ -16,9 +16,11 @@ type t = In custom mode, also returns the rif values read on stdin (returns the empty string in other modes). + +f dummy_input verbose_mode demon pl all enab *) type pna = Process.t * Topology.neighbor list * Algo.action -val f : bool -> t -> Process.t list -> pna list list -> bool list list -> +val f : bool -> bool -> t -> Process.t list -> pna list list -> bool list list -> string * pna list diff --git a/lib/sasacore/genLutin.ml b/lib/sasacore/genLutin.ml index 8168d27a5f8b6540048c1d888cd063b4982a1567..167681dd5120bad1454719385925a91771e26420 100644 --- a/lib/sasacore/genLutin.ml +++ b/lib/sasacore/genLutin.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 22/03/2019 (at 14:30) by Erwan Jahier> *) +(* Time-stamp: <modified the 28/03/2019 (at 18:16) by Erwan Jahier> *) open Process @@ -63,6 +63,11 @@ let (f: Process.t list -> string) = (* let atleastone = "("^(String.concat " or " al)^") and " in *) let macro = Printf.sprintf "%s %s + +-- useful for using built-in demons with rdbg (add --dummy-input option to sasa) +node dummy() +returns(_dummy:bool) = loop true + let demon_prop(%s,\n\t%s:bool):bool =\n\t\t%s%s" (Mypervasives.entete "--" SasaVersion.str SasaVersion.sha) atmost_macro (ins "\n\t") (outs "\n\t") acti_if_enab one_per_process diff --git a/lib/sasacore/sasArg.ml b/lib/sasacore/sasArg.ml index 0df1320ed9677de462ddf8d84d8edbdb939cd408..6ce0918b9d55c971dd308659c7b239bd569b57b9 100644 --- a/lib/sasacore/sasArg.ml +++ b/lib/sasacore/sasArg.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 28/03/2019 (at 10:40) by Erwan Jahier> *) +(* Time-stamp: <modified the 28/03/2019 (at 17:56) by Erwan Jahier> *) type t = { @@ -10,6 +10,7 @@ type t = { mutable seed: int; mutable ifi: bool; mutable gen_lutin: bool; + mutable dummy_input: bool; mutable _args : (string * Arg.spec * string) list; mutable _user_man : (string * string list) list; @@ -36,6 +37,7 @@ let (make_args : unit -> t) = seed = (Random.self_init (); Random.int 1073741823); ifi = false; gen_lutin = false; + dummy_input = false; _args = []; _user_man = []; _hidden_man = []; @@ -117,6 +119,10 @@ let (mkoptab : string array -> t -> unit) = (Arg.Unit(fun () -> args.gen_lutin <- true)) ["Generate Lutin demons and exit"]; + mkopt args ~hide:true ["--dummy-input"] + (Arg.Unit(fun () -> args.dummy_input <- true)) + ["Add a dummy input to sasa so that built-in demon can be used from rdbg"]; + mkopt args ~hide:true ["--ignore-first-inputs"; "-ifi"] (Arg.Unit(fun () -> args.ifi <- true)) ["Ignore first inputs (necessary to use luciole via lurette/rdbg/luciole-rif)"]; diff --git a/lib/sasacore/sasArg.mli b/lib/sasacore/sasArg.mli index 77b81b620fc181a05a9068f1ccb8a655d1beb731..e679d4d99e151b348cbc5f51a8bcd806c7382c70 100644 --- a/lib/sasacore/sasArg.mli +++ b/lib/sasacore/sasArg.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 15/03/2019 (at 22:37) by Erwan> *) +(* Time-stamp: <modified the 28/03/2019 (at 17:54) by Erwan Jahier> *) type t = { @@ -10,6 +10,7 @@ type t = { mutable seed: int; mutable ifi: bool; mutable gen_lutin: bool; + mutable dummy_input: bool; mutable _args : (string * Arg.spec * string) list; mutable _user_man : (string * string list) list; diff --git a/lib/sasacore/sasa.ml b/lib/sasacore/sasa.ml index 15fab72c9284c7e2dbc5e213a8f5b176da31335b..b6eb2cde430e92b95303ccb8d71e57d875663490 100644 --- a/lib/sasacore/sasa.ml +++ b/lib/sasacore/sasa.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 28/03/2019 (at 17:41) by Erwan Jahier> *) +(* Time-stamp: <modified the 28/03/2019 (at 18:10) by Erwan Jahier> *) open Algo open Sasacore @@ -125,7 +125,7 @@ let (simustep: int -> int -> SasArg.t -> Process.t list -> string -> ); print_step n i args e pl activate_val enable_val; let next_activate_val, pnal = - Demon.f (args.verbose > 1) args.demon pl all enab_ll + Demon.f args.dummy_input (args.verbose > 1) args.demon pl all enab_ll in (* 2: Do the steps *) let lenv_list = @@ -188,7 +188,8 @@ let (make : string array -> t) = Printf.printf "%s" (Mypervasives.entete "#" SasaVersion.str SasaVersion.sha); if args.demon <> Demon.Custom then Printf.printf "#seed %i\n" args.seed; - Printf.printf "#inputs %s\n" + Printf.printf "#inputs %s %s\n" + (if args.demon <> Custom && args.dummy_input then "_dummy:bool" else "") (if args.demon = Demon.Custom then ( let f p = List.map (fun a -> "\""^p.pid ^(if a="" then "" else "_")^a^ "\":bool")