Commit b541e723 authored by erwan's avatar erwan
Browse files

New: add a --dummy-input option that let one uses build-in demons from rdbg

parent 03954400
(* 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)
......
(* 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
(* 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
......
(* 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)"];
......
(* 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;
......
(* 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")
......
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