Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 8c24cdb7 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

lurette 0.68 Fri, 17 May 2002 17:59:13 +0200 by jahier

Parent-Version:      0.67
Version-Log:

Add a verbose option in ima_exe.

Fix a bug in show_env.ml introduced in the previuos pci.

Add support to dynamically load another ima from ima_exe (will usefull for
Ludic).

Project-Description: Lurette
parent a092979c
......@@ -2,9 +2,9 @@
;; REALLY bad things.
(Created-By-Prcs-Version 1 3 3)
(test/usager.env 523 1019479246 b/14_usager.env 1.7)
(source/command_line_ima_exe.mli 1045 1020420514 b/34_command_li 1.2)
(source/command_line_ima_exe.mli 1082 1021651153 b/34_command_li 1.3)
(doc/ocamldoc.sty 1380 1008328137 b/12_ocamldoc.s 1.1)
(source/env_state.ml 13465 1021042464 51_env_state. 1.21)
(source/env_state.ml 13591 1021651153 51_env_state. 1.22)
(source/graph.ml 1822 1021539278 14_graph.ml 1.6)
(bin/Makefile.ima_exe 1926 1020420514 b/41_Makefile.i 1.2)
(source/util.ml 13368 1021041152 35_util.ml 1.20)
......@@ -12,7 +12,7 @@
(source/solver.ml 24391 1021539278 39_solver.ml 1.22)
(test/test_gen_stubs.h 1818 1020068208 b/45_test_gen_s 1.1)
(source/command_line.ml 4388 1019207707 b/20_command_li 1.7)
(source/lurette.ml 11959 1021042464 12_lurette.ml 1.38)
(source/lurette.ml 12133 1021651153 12_lurette.ml 1.39)
(source/solver.mli 1138 1020432102 38_solver.mli 1.11)
(source/env.mli 2077 1020420514 15_env.mli 1.13)
(test/heater_float.rif.exp 1461 1015514807 b/30_heater_flo 1.2)
......@@ -25,9 +25,9 @@
(doc/archi.fig 3693 1003928781 20_archi.fig 1.1)
(source/rnumsolver.ml 10783 1017837703 b/27_rnumsolver 1.6)
(ID_EN_VRAC 2184 1002196285 0_ID_EN_VRAC 1.1)
(source/parse_env.mli 908 1020420514 40_parse_env. 1.7)
(source/parse_env.mli 906 1021651153 40_parse_env. 1.8)
(source/sim2chro.mli 1429 1017929190 b/23_sim2chro.m 1.4)
(source/ima_exe.ml 9860 1021539278 b/32_ima_exe.ml 1.11)
(source/ima_exe.ml 11622 1021651153 b/32_ima_exe.ml 1.12)
(doc/automata_format 0 1007379917 b/3_automata_f 1.1)
(source/eval.ml 7749 1016803757 49_eval.ml 1.12)
(source/gen_stubs.ml 36621 1021042464 24_generate_l 1.26)
......@@ -40,18 +40,18 @@
(source/command_line.mli 1421 1017929190 b/21_command_li 1.6)
(source/wtree.mli 3320 1021539278 b/0_wtree.mli 1.11)
(test/porte.env 1130 1019479246 b/16_porte.env 1.6)
(source/env_state.mli 5887 1021041152 50_env_state. 1.18)
(source/env_state.mli 5986 1021651153 50_env_state. 1.19)
(source/rnumsolver.mli 1764 1017335442 b/26_rnumsolver 1.3)
(source/ima_exe.mli 447 1016127950 b/31_ima_exe.ml 1.1)
(source/eval.mli 1389 1016803757 48_eval.mli 1.9)
(README 74 1011881677 10_README 1.2)
(test/ControleurPorte.c 9407 1012914629 b/19_Controleur 1.1)
(OcamlMakefile 22550 1021041152 17_OcamlMakef 1.29)
(source/command_line_ima_exe.ml 2665 1020420514 b/33_command_li 1.3)
(source/command_line_ima_exe.ml 2792 1021651153 b/33_command_li 1.4)
(test/ControleurPorte.rif.exp 4746 1016803757 b/29_Controleur 1.4)
(test/tram.env 1149 1019479246 b/15_tram.env 1.6)
(Makefile.lurette 1866 1020420514 b/38_Makefile.l 1.3)
(source/show_env.ml 3701 1021549908 43_show_env.m 1.8)
(source/show_env.ml 3768 1021651153 43_show_env.m 1.9)
(source/gne.mli 1107 1016803757 b/36_gne.mli 1.1)
(bin/Makefile.gen_stubs 467 1020068208 b/42_Makefile.g 1.1)
(doc/synthese 2556 1007379917 b/2_synthese 1.1)
......
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Lurette")
(Project-Version lurette 0 67)
(Parent-Version lurette 0 66)
(Project-Version lurette 0 68)
(Parent-Version lurette 0 67)
(Version-Log "
Draw loop nodes as circles and other nodes as boxes in the dot output
of the ima files.
Add a verbose option in ima_exe.
Fix a bug in show_env.ml introduced in the previuos pci.
Add support to dynamically load another ima from ima_exe (will usefull for Ludic).
")
(New-Version-Log "")
(Checkin-Time "Thu, 16 May 2002 13:51:48 +0200")
(Checkin-Time "Fri, 17 May 2002 17:59:13 +0200")
(Checkin-Login jahier)
(Populate-Ignore ())
(Project-Keywords)
......@@ -20,14 +23,14 @@ of the ima files.
;; Sources files for ima_exe
(source/ima_exe.mli (lurette/b/31_ima_exe.ml 1.1 644))
(source/ima_exe.ml (lurette/b/32_ima_exe.ml 1.11 644))
(source/ima_exe.ml (lurette/b/32_ima_exe.ml 1.12 644))
(source/command_line_ima_exe.ml (lurette/b/33_command_li 1.3 644))
(source/command_line_ima_exe.mli (lurette/b/34_command_li 1.2 644))
(source/command_line_ima_exe.ml (lurette/b/33_command_li 1.4 644))
(source/command_line_ima_exe.mli (lurette/b/34_command_li 1.3 644))
;; Sources files for lurette only
(source/lurette.mli (lurette/11_lurette.ml 1.12 644))
(source/lurette.ml (lurette/12_lurette.ml 1.38 644))
(source/lurette.ml (lurette/12_lurette.ml 1.39 644))
(source/command_line.ml (lurette/b/20_command_li 1.7 644))
(source/command_line.mli (lurette/b/21_command_li 1.6 644))
......@@ -47,11 +50,11 @@ of the ima files.
(source/rnumsolver.mli (lurette/b/26_rnumsolver 1.3 644))
(source/rnumsolver.ml (lurette/b/27_rnumsolver 1.6 644))
(source/parse_env.mli (lurette/40_parse_env. 1.7 644))
(source/parse_env.mli (lurette/40_parse_env. 1.8 644))
(source/parse_env.ml (lurette/41_parse_env. 1.19 644))
(source/show_env.mli (lurette/42_show_env.m 1.6 644))
(source/show_env.ml (lurette/43_show_env.m 1.8 644))
(source/show_env.ml (lurette/43_show_env.m 1.9 644))
(source/formula.mli (lurette/44_formula.ml 1.13 644))
(source/formula.ml (lurette/45_formula.ml 1.15 644))
......@@ -62,8 +65,8 @@ of the ima files.
(source/eval.mli (lurette/48_eval.mli 1.9 644))
(source/eval.ml (lurette/49_eval.ml 1.12 644))
(source/env_state.mli (lurette/50_env_state. 1.18 644))
(source/env_state.ml (lurette/51_env_state. 1.21 644))
(source/env_state.mli (lurette/50_env_state. 1.19 644))
(source/env_state.ml (lurette/51_env_state. 1.22 644))
(source/wtree.mli (lurette/b/0_wtree.mli 1.11 644))
(source/wtree.ml (lurette/b/1_wtree.ml 1.13 644))
......
......@@ -12,11 +12,12 @@
type optionsT = {
mutable show_automata : bool ;
mutable boot : bool ;
mutable user_seed : int
mutable user_seed : int ;
mutable verbose : bool
}
type cmd_line_optionT =
Seed | Boot | ShowAut | NoShowAut
Seed | Boot | ShowAut | NoShowAut | Verbose
(* Names of the command line options to override the defaults. *)
let (string_to_option: (string * cmd_line_optionT) list) = [
......@@ -30,6 +31,9 @@ let (string_to_option: (string * cmd_line_optionT) list) = [
("--show-aut", ShowAut);
("-s", ShowAut);
("--verbose", Verbose);
("-v", Verbose);
("--no-show-aut", NoShowAut)
]
......@@ -40,7 +44,7 @@ let (option_to_usage: cmd_line_optionT -> string) =
| ShowAut -> "Run ima_exe showing the ima automata step.\n"
| NoShowAut -> "Do not show the ima automata (Default).\n"
| Seed -> "Set the value of the seed the random engine is initialized with (0 lets the system draw a seed).\n"
| Verbose -> "Set on a verbose mode.\n"
let (group_common_options: (string * cmd_line_optionT) list ->
(string * cmd_line_optionT) list) =
......
......@@ -15,7 +15,8 @@
type optionsT = {
mutable show_automata : bool ;
mutable boot : bool ;
mutable user_seed : int
mutable user_seed : int ;
mutable verbose : bool
}
val usage : string
......@@ -28,7 +29,7 @@ val cmd_line_string_to_int : string -> string -> int
*)
type cmd_line_optionT =
Seed | Boot | ShowAut | NoShowAut
Seed | Boot | ShowAut | NoShowAut | Verbose
val string_to_option: (string * cmd_line_optionT) list
......
......@@ -124,6 +124,11 @@ let (set_var_names : string -> vnt list * vnt list * vnt list -> unit) =
Hashtbl.replace env_state.var_names file vntl
let (clear_ima : unit -> unit) =
fun _ ->
Hashtbl.clear env_state.var_names ;
env_state.graph <- Graph.create ()
let (in_env_unsorted : unit -> vnt list) =
fun _ ->
let vnt_list =
......
......@@ -36,6 +36,8 @@ val var_names : string -> vnt list * vnt list * vnt list
(** Sets the var names and types of an env automata. *)
val set_var_names : string -> vnt list * vnt list * vnt list -> unit
(** Clear the current ima in order to dynamically load another one *)
val clear_ima : unit -> unit
(** Returns all the input variables, unsorted. *)
val in_env_unsorted : unit -> vnt list
......
......@@ -22,18 +22,65 @@ open Command_line_ima_exe
let (options:Command_line_ima_exe.optionsT) = {
show_automata = false ;
user_seed = 0 ;
boot = false
boot = false ;
verbose = false
}
(*------------------------------------------------------------------------*)
(* RIF parsing *)
let lexer = Genlex.make_lexer ["#"; "#@"; "@#"]
type rif_token = Genlex.token
type rif_stream = Genlex.token Stream.t
let rec (parse_ima_files : rif_stream -> string list list -> string list list) =
fun stream sll ->
try (
match (Stream.next stream) with
(Genlex.String str) -> parse_ima_files stream ([str]::sll)
| (Genlex.Kwd "x") ->
( match (sll, (Stream.next stream)) with
((sl::tail), (Genlex.String str2)) ->
parse_ima_files stream ((append sl [str2])::tail)
| _ ->
failwith "### parse error.\n"
)
| _ -> failwith "### parse error. A string (wrapped with double quotes) or `x' was expected. \n"
)
with Stream.Failure ->
sll
(* Dynamically change the current env automata *)
let (replace_env_dynamically: rif_stream -> unit) =
fun stream ->
let ima_files = parse_ima_files stream [] in
Env_state.clear_ima ();
output_string stderr "loading ";
List.iter (fun x -> output_string stderr (x ^ " ")) (List.flatten ima_files);
output_string stderr " ...\n ";
Env_state.read_env_state ima_files;
output_string stderr " ... ok\n";
Env_state.set_output_var_names (Env_state.out_env_unsorted ()) ;
if options.show_automata then (
Show_env.generate_env_graph (flatten (Env_state.current_nodes ())) []
("automata" ^ (string_of_int (Hashtbl.hash Sys.argv)))
(Env_state.graph ()) ;
) ;
print_string "#inputs ";
List.iter
(fun (vn,vt) ->
print_string (vn ^ ":" ^ (var_type_to_string2 vt) ^ " ")
)
(Env_state.out_env_unsorted ());
print_string "\n";
flush stdout;
flush stderr
(*------------------------------------------------------------------------*)
(* RIF parsing *)
let lexer = Genlex.make_lexer ["#"; "x"; "load_ima"; "#@"; "@#"]
let rif_pragmas = ["inputs"]
(* Which pragmas should be defined ? *)
......@@ -74,6 +121,16 @@ and (parse_rif_stream : vnt list -> rif_stream -> env_in -> env_in) =
parse_rif_stream vntl (lexer (Stream.of_string (read_line ()))) tbl
)
| [Genlex.Kwd "#" ; Genlex.Kwd "load_ima"]
(* dynamically change the environment *)
->
(
Stream.junk stream ;
Stream.junk stream ;
replace_env_dynamically stream;
parse_rif_stream (Env_state.in_env_unsorted ()) (lexer (Stream.of_string (read_line ()))) tbl
)
| (Genlex.Kwd "#")::_
(* Ditto *)
->
......@@ -183,6 +240,7 @@ and
ShowAut -> options.show_automata <- true ; (n+1)
| NoShowAut -> options.show_automata <- false ; (n+1)
| Boot -> options.boot <- true ; (n+1)
| Verbose -> options.verbose <- true ; (n+1)
| Seed ->
let str = (Sys.argv.(n+1)) in
options.user_seed <- cmd_line_string_to_int str
......@@ -227,13 +285,7 @@ and
(* Initialisation of `Env_state.env_state' *)
let env_llist = (get_env_from_args 1 []) in
let () = Env_state.read_env_state env_llist in
let local_var_name_and_type_list_unsorted0 = Env_state.loc_env_unsorted () in
let local_var_name_and_type_list_unsorted =
List.map (fun (vn, vt) -> (vn, (var_type_to_string vt)))
local_var_name_and_type_list_unsorted0
in
(* Initialisation of the random engine *)
let seed =
if (options.user_seed = 0)
......@@ -256,7 +308,6 @@ and
Env_state.set_output_var_names (Env_state.out_env_unsorted ()) ;
(* Initializing the solution number table *)
Env_state.set_sol_number
(Bdd.dtrue (Env_state.bdd_manager ())) (Util.one_sol, Util.zero_sol);
......@@ -295,12 +346,13 @@ and
let nl = List.flatten previous_nodes in
let _ =
(* xxx --verbose !!! *)
(* List.iter *)
(* (fun n -> output_string stderr ((string_of_int n) ^ " ")) *)
(* nl; *)
(* flush stderr; *)
(* xxx *)
if options.verbose then
(
List.iter
(fun n -> output_string stderr ("current nodes:" ^ (string_of_int n) ^ "\n "))
nl;
flush stderr
) ;
print_string ("\n# step " ^ (string_of_int t) ^ " (") ;
if (List.length nl) > 1
......
......@@ -25,7 +25,7 @@ let (options:Command_line.optionsT) = {
verbose = false ;
help = false ;
output = "lurette.rif" ;
oracle = true
oracle = true
}
......@@ -255,8 +255,14 @@ and
main_loop t s n p rif sut_output =
let _ =
if options.verbose
then print_string ("\n--- step " ^ (string_of_int t) ^ ":\n"); flush stdout
if options.verbose then
(
output_string stderr ("\n--- step " ^ (string_of_int t) ^ ":\n");
List.iter
(fun n -> output_string stderr ("current nodes:" ^ (string_of_int n) ^ "\n "))
(List.flatten (Env_state.current_nodes ()));
flush stderr
);
in
(* Generates `n*p' inputs from the environment *)
......
......@@ -8,14 +8,13 @@
** Author: jahier@imag.fr
*)
(** Environnement automata ([.env] files) parser. *)
(** Environnement automata ([.ima] files) parser. *)
open Formula
(** Environnement automata tokens. *)
type aut_token = Genlex.token Stream.t
type read_arc = Arc of node * arc_info * node
type read_automata = Automata of
......
......@@ -17,35 +17,39 @@ let (dump_nodes_list: out_channel -> node list -> node list -> node list
fun oc pnodes cnodes loopnodes node_list ->
let (dump_node: node -> unit) =
fun node ->
output_string oc ("\t;\t" ^ (string_of_int node) ^ "\n");
output_string oc ("\t;\t" ^ (string_of_int node) ^ " ");
if
(List.mem node cnodes)
then
(
output_string oc "[style=filled,peripheries=2,color=red ";
flush oc ;
if
(not (List.mem node loopnodes))
then
output_string oc ", shape=box] "
else
output_string oc "] ";
)
flush oc ;
)
else if
(List.mem node pnodes)
then
(
output_string oc "style=filled,color=green ";
output_string oc "[style=filled,color=green ";
if
(not (List.mem node loopnodes))
then
output_string oc ", shape=box] "
else
output_string oc "] "
output_string oc "] ";
flush oc ;
) ;
if
(not (List.mem node loopnodes))
then
output_string oc "[shape=box] ";
flush oc ;
in
match node_list with
elt::tail ->
......
Markdown is supported
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