Skip to content
Snippets Groups Projects
Commit 851fdc07 authored by erwan's avatar erwan
Browse files

Fix the result of -rif when not used with custum demon

parent 6929ab22
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 10/03/2019 (at 16:18) by Erwan Jahier> *)
(* Time-stamp: <modified the 10/03/2019 (at 21:08) by Erwan Jahier> *)
(* XXX Je pourrais utiliser Lwt pour rendre step non-bloquant, ce qui
permettrait d'accelerer la simu sur les machines qui ont plusieurs
......@@ -67,8 +67,16 @@ exception Silent of int
let (print_step : int -> int -> Env.t -> Process.t list -> string -> unit) =
fun n i e pl str ->
if SasArg.args.rif then (
Printf.eprintf "\n#step %s\n" (string_of_int (n-i+1)) ;
Printf.eprintf "%s #outs " str; flush stderr;
if SasArg.args.demon = Demon.Custom then (
(* in custom mode, to be able to talk with lurette, this should not be
printed on stdout
*)
Printf.eprintf "\n#step %s\n" (string_of_int (n-i+1)) ;
Printf.eprintf "%s #outs " str; flush stderr
) else (
Printf.printf "\n#step %s\n" (string_of_int (n-i+1)) ;
Printf.printf "%s #outs " str; flush stdout
);
Printf.printf "%s\n" (StringOf.env_rif e pl);
flush stdout
)
......@@ -108,7 +116,7 @@ let rec (simu: int -> int -> Process.t list ->
(* update the env *)
let ne = List.fold_left update_env e lenv_list in
let al_str = if args.demon = Demon.Custom then
let al_str = if args.rif then
input_string
else
"("^String.concat ","
......@@ -119,7 +127,7 @@ let rec (simu: int -> int -> Process.t list ->
(* | [_] -> () *)
| [] -> assert false
| _ -> if i > 0 then simu n (i-1) pl pl_n ne else (
if SasArg.args.rif then (
if SasArg.args.rif && args.demon = Custom then (
print_string "q\n"; flush stdout
))
......@@ -169,6 +177,6 @@ let () =
let str = if SasArg.args.rif then "#" else "" in
Printf.printf "%sThis algo is silent after %i steps\n" str i ;
flush stdout;
if SasArg.args.rif then (
if SasArg.args.rif && args.demon = Custom then (
print_string "q\n"; flush stdout
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment