Skip to content
Snippets Groups Projects
Commit 294cb67c authored by erwan's avatar erwan
Browse files

New: add a --list-algos (-algo) option, that output the algo names used in the dot file and exit.

This can be used from rdbg from example, to generate session files.

In particular, 'rdbg -lurette' now works thanls to this option
(cf rdbg sha 63566a893807361691137cafe15854a2a7395eec)

Remove the --generate-rdbg-load one that is less general
parent f1b7686e
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 06/05/2019 (at 14:47) by Erwan Jahier> *)
(* Time-stamp: <modified the 15/05/2019 (at 15:32) by Erwan Jahier> *)
type t = {
......@@ -11,7 +11,7 @@ type t = {
mutable ifi: bool;
mutable gen_lutin: bool;
mutable dummy_input: bool;
mutable generate_rdbg_load_files: bool;
mutable output_algos: bool;
mutable _args : (string * Arg.spec * string) list;
mutable _user_man : (string * string list) list;
......@@ -39,7 +39,7 @@ let (make_args : unit -> t) =
ifi = false;
gen_lutin = false;
dummy_input = false;
generate_rdbg_load_files = false;
output_algos = false;
_args = [];
_user_man = [];
_hidden_man = [];
......@@ -121,10 +121,9 @@ let (mkoptab : string array -> t -> unit) =
(Arg.Unit(fun () -> args.gen_lutin <- true))
["Generate Lutin demons and exit"];
mkopt args ~hide:true ["--generate-rdbg-load"]
(Arg.Unit(fun () -> args.generate_rdbg_load_files <- true))
["Generate a file meant to be included by rdbg, and exit. ";
"This file allows one to load the node algo cma files "];
mkopt args ~hide:true ["--list-algos";"-algo"]
(Arg.Unit(fun () -> args.output_algos <- true))
["Output the algo names used in the dot file and exit. "];
mkopt args ~hide:true ["--dummy-input"]
(Arg.Unit(fun () -> args.dummy_input <- true))
......@@ -132,15 +131,18 @@ let (mkoptab : string array -> t -> unit) =
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)"];
["Ignore first inputs (necessary to use luciole via ";
"lurette/rdbg/luciole-rif)"];
mkopt args ["--length";"-l"] ~arg:" <int>"
(Arg.Int (fun i -> args.length <- i))
["Maximum number of steps to be done (" ^ (string_of_int args.length) ^ " by default).\n"];
["Maximum number of steps to be done (" ^
(string_of_int args.length) ^ " by default).\n"];
mkopt args ["--version";"-version";"-v"]
(Arg.Unit (fun _ ->
(print_string (SasaVersion.str^"-"^SasaVersion.sha^"\n");flush stdout;exit 0)))
(print_string (SasaVersion.str^"-"^SasaVersion.sha^"\n");
flush stdout;exit 0)))
["Display the sasa version and exit."];
mkopt args ~hide:true ["--ocaml-version"]
......
(* Time-stamp: <modified the 06/05/2019 (at 14:24) by Erwan Jahier> *)
(* Time-stamp: <modified the 15/05/2019 (at 15:32) by Erwan Jahier> *)
type t = {
mutable topo: string;
......@@ -10,7 +10,7 @@ type t = {
mutable ifi: bool;
mutable gen_lutin: bool;
mutable dummy_input: bool;
mutable generate_rdbg_load_files: bool;
mutable output_algos: bool;
mutable _args : (string * Arg.spec * string) list;
mutable _user_man : (string * string list) list;
......
(* Time-stamp: <modified the 13/05/2019 (at 15:03) by Erwan Jahier> *)
(* Time-stamp: <modified the 15/05/2019 (at 15:36) by Erwan Jahier> *)
open Algo
open Sasacore
......@@ -182,25 +182,12 @@ let (make : bool -> string array -> t) =
let e = update_env_with_init e pl algo_neighors in
let pl_n = List.combine pl algo_neighors in
if !Algo.verbose_level > 0 then List.iter dump_process pl_n;
if args.generate_rdbg_load_files then (
let fn = Printf.sprintf "load-%s.ml" args.topo in
if Sys.file_exists fn then (
Printf.eprintf "%s already exists: rename it to update.\n" fn;
flush stderr; exit 0
) else
let oc = open_out fn in
let files = List.fold_left
(fun acc n ->
let f = (Filename.chop_extension n.Topology.file) ^ ".cma" in
if List.mem f acc then acc else f::acc)
[] nl
in
let loadl = List.map (fun s -> Printf.sprintf "#load \"%s\"" s) files in
Printf.fprintf oc "%s" (String.concat "\n" loadl);
flush oc;
close_out oc;
exit 0
if args.output_algos then (
let fl = List.map (fun n -> Filename.chop_extension n.Topology.file) nl in
let fl = List.sort_uniq compare fl in
Printf.printf "%s\n" (String.concat "\n" fl);
flush stdout;
exit 0
);
if args.gen_lutin then (
let fn = (Filename.remove_extension args.topo) ^ ".lut" in
......
# Time-stamp: <modified the 14/05/2019 (at 14:34) by Erwan Jahier>
# Time-stamp: <modified the 15/05/2019 (at 15:45) by Erwan Jahier>
DIR=../../_build/install/default
sasa=sasa -seed 42 -l 100
......@@ -23,7 +23,7 @@ s:sim2chrogtk
clean:
rm -f *.cmxs sasa *.cm* *.o *.pdf *.rif *.gp *.log *.dro *.seed *.c sasa-*.dot
rm -f rdbg-session*.ml
rm -f rdbg-session*.ml luretteSession*.ml
##################################################################################
# Essais en cours
......
# Time-stamp: <modified the 04/04/2019 (at 17:55) by Erwan Jahier>
# Time-stamp: <modified the 14/05/2019 (at 14:43) by Erwan Jahier>
test: test0 lurette0
......@@ -24,7 +24,12 @@ gnuplot2: fig5.2.rif
lurette0:cmxs fig5.1-noinit.lut
lurette -o lurette.rif \
-env "$(sasa) fig5.1-noinit.dot -custd -rif" \
-env "sasa fig5.1-noinit.dot -custd -rif" \
-sut "lutin fig5.1-noinit.lut -n distributed"
lurette0bis:cmxs fig5.1-noinit.lut
rdbg -lurette -o lurette.rif \
-env "sasa fig5.1-noinit.dot -custd -rif" \
-sut "lutin fig5.1-noinit.lut -n distributed"
lurette: lurette0
......
# Time-stamp: <modified the 04/04/2019 (at 21:15) by Erwan Jahier>
# Time-stamp: <modified the 15/05/2019 (at 10:09) by Erwan Jahier>
test: p.cmxs ring.lut
......@@ -13,7 +13,7 @@ gnuplot: ring.rif
gnuplot-rif $<
rdbg: p.cmxs ring.lut
rdbg: p.cma ring.lut
rdbg -o ring.rif \
-env "$(sasa) ring.dot -custd -rif" \
-sut-nd "lutin ring.lut -n distributed"
......
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