Commit 8d11bd37 authored by Erwan Jahier's avatar Erwan Jahier

lurette 0.142 Thu, 26 Jun 2003 11:17:53 +0200 by jahier

Parent-Version:      0.141
Version-Log:

source/show_luc.ml:
source/show_env.ml:
  Add a command line option to set the max nb of char before
  truncate formula.

Project-Description: Lurette
parent ed63acb4
;; This file is automatically generated, editing may cause PRCS to do
;; REALLY bad things.
(Created-By-Prcs-Version 1 3 3)
(source/show_env.mli 1143 1056616700 42_show_env.m 1.9)
(source/show_env.mli 1150 1056619073 42_show_env.m 1.10)
(source/util.ml 24271 1056616700 35_util.ml 1.51)
(cuddaux/cuddauxGenCof.c 12011 1034006019 c/29_cuddauxGen 1.1)
(test/cygwin-scade/lib_pilot.vsp 1433 1055926783 f/47_lib_pilot. 1.1)
......@@ -194,7 +194,7 @@
(test/usager.luc 508 1046682069 b/14_usager.env 1.11)
(mlcuddidl/manager.idl 11024 1034006019 c/48_manager.id 1.1)
(mlcuddidl/cudd_caml.h 1210 1034006019 d/2_cudd_caml. 1.1)
(source/show_env.ml 3691 1056616700 43_show_env.m 1.17)
(source/show_env.ml 3668 1056619073 43_show_env.m 1.18)
(polka/C/essai.c 1001 1047029868 e/11_essai.c 1.1)
(share/pixmaps/button-close.xpm 746 1055926783 f/24_button-clo 1.1)
(test/cygwin-scade/regulation.saofd 15074 1055926783 f/35_regulation 1.1)
......@@ -220,7 +220,7 @@
(test/cygwin-scade/.lurette_rc 483 1055926783 f/29_.lurette_r 1.1)
(source/env_state.mli 6742 1056616700 50_env_state. 1.31)
(test/ControleurPorte.rif.exp 4676 1056616700 b/29_Controleur 1.16)
(source/show_luc.ml 3244 1056616700 e/25_show_luc.m 1.4)
(source/show_luc.ml 3998 1056619073 e/25_show_luc.m 1.5)
(share/pixmaps/quit.xpm 494 1055926783 f/14_quit.xpm 1.1)
(polka/caml/polka_lexer.mli 200 1047029868 d/41_polka_lexe 1.1)
(polka/caml/polka.mli 716 1047029868 d/38_polka.mli 1.1)
......
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Lurette")
(Project-Version lurette 0 141)
(Parent-Version lurette 0 140)
(Project-Version lurette 0 142)
(Parent-Version lurette 0 141)
(Version-Log "
source/lurette.ml
source/luc_exe.ml
source/env_state.ml:
Infer that environments share controllable vars instead of asking it to users.
Also allow any string to be a valid node name.
source/show_luc.ml:
source/show_env.ml:
Add a command line option to set the max nb of char before
truncate formula.
Also fix a bug where, when several env were provided, the Env_state.file_name
was not returning the rigth file name. Actually it was not really a bug since
it could not be triggered before this change ... It just happen to work
correctly by chance.
")
(New-Version-Log ""
)
(Checkin-Time "Thu, 26 Jun 2003 10:38:20 +0200")
(Checkin-Time "Thu, 26 Jun 2003 11:17:53 +0200")
(Checkin-Login jahier)
(Populate-Ignore ())
(Project-Keywords)
......@@ -66,8 +61,8 @@ source/env_state.ml:
(source/parse_env.mli (lurette/40_parse_env. 1.15 644))
(source/parse_env.ml (lurette/41_parse_env. 1.46 644))
(source/show_env.mli (lurette/42_show_env.m 1.9 644))
(source/show_env.ml (lurette/43_show_env.m 1.17 644))
(source/show_env.mli (lurette/42_show_env.m 1.10 644))
(source/show_env.ml (lurette/43_show_env.m 1.18 644))
(source/formula.mli (lurette/44_formula.ml 1.24 644))
(source/formula.ml (lurette/45_formula.ml 1.30 644))
......@@ -124,7 +119,7 @@ source/env_state.ml:
(source/parse_poc.mli (lurette/d/29_parse_poc. 1.2 644))
(source/gen_fake_lutin.ml (lurette/d/16_gen_fake_l 1.5 644))
(source/show_luc.ml (lurette/e/25_show_luc.m 1.4 644))
(source/show_luc.ml (lurette/e/25_show_luc.m 1.5 644))
(source/ocaml2c.idl (lurette/e/26_ocaml2c.id 1.2 644))
(source/lurette_exe.c (lurette/e/27_lurette_ex 1.2 644))
(source/call_lurette_main.c (lurette/e/28_call_luret 1.1 644))
......
......@@ -111,21 +111,19 @@ let (graph_to_dot: 'node list -> 'node list -> string ->
Util.dot dot_file ps_file
(* Exported *)
let max_label_size = 80
(* Exported *)
let arc_to_string_trunc arc =
let arc_to_string_trunc max_size arc =
let str = Formula.arc_info_to_string arc in
if String.length str <= max_label_size
if String.length str <= max_size
then str
else ((String.sub str 0 max_label_size) ^ " ...")
else ((String.sub str 0 max_size) ^ " ...")
(* Exported *)
let (luc_to_dot: Formula.node list -> Formula.node list -> string ->
(Formula.node, Formula.arc_info) Graph.t -> unit) =
fun pnodes cnodes str graph ->
graph_to_dot pnodes cnodes str Formula.string_of_node arc_to_string_trunc graph
graph_to_dot pnodes cnodes str Formula.string_of_node (arc_to_string_trunc 80) graph
......
......@@ -27,5 +27,5 @@ val graph_to_dot : 'node list -> 'node list -> string ->
arcs. One has to provide 2 functions from ['node] and from ['arc]
to [string] though. *)
val arc_to_string_trunc : Formula.arc_info -> string
val arc_to_string_trunc : int -> Formula.arc_info -> string
......@@ -16,6 +16,21 @@ type node_label = string
let arg_nb = (Array.length Sys.argv)
type flagT = {
mutable max_size : int ;
mutable env : string list
}
let (flag : flagT) = {
max_size = 100 ;
env = []
}
let rec (get_env_from_args: int -> string list list -> string list list) =
fun n file_ll ->
if (n = arg_nb) then file_ll
......@@ -82,32 +97,63 @@ let (read_env_state_one_file : (node_label, arc_info) Graph.t -> string ->
(****************************************************************************)
let (read_env_state : string list list -> (node_label, arc_info) Graph.t) =
fun files_ll ->
let (read_env_state : string list -> (node_label, arc_info) Graph.t) =
fun files_l ->
(** Calls [read_env_state_one_file] on a list of list of files. *)
List.fold_left (read_env_state_one_file) (Graph.create ()) (List.flatten files_ll)
List.fold_left (read_env_state_one_file) (Graph.create ()) files_l
(****************************************************************************)
let usage = "usage: show_luc [<options>]* <.luc files>+\n"
let rec speclist =
[
"--formula-size", Arg.Int (fun s -> flag.max_size <- s),
"<int>\tMax number of char used to display formula before being truncated.";
"-s", Arg.Int (fun s -> flag.max_size <- s),
("\t\t\tDefault is " ^ (string_of_int flag.max_size) ^ ".\n");
"--help", Arg.Unit (fun _ -> (Arg.usage speclist usage ; exit 0)),
"\t\tDisplay this list of options." ;
"-help", Arg.Unit (fun _ -> (Arg.usage speclist usage ; exit 0)),
"";
"-h", Arg.Unit (fun _ -> (Arg.usage speclist usage ; exit 0)),
""
]
let rec (main : unit -> 'a) =
fun _ ->
if
arg_nb = 1
then
output_string stderr "At least one arg is expected.\nusage: show_luc <.luc files>+\n"
else if
let header_file = Sys.argv.(1) in
((header_file = "--help") || (header_file = "-help") || (header_file = "-h") )
(Array.length Sys.argv) = 1
then
output_string stdout "usage: show_luc <.luc files>+\n"
(
Arg.usage speclist usage;
exit 1
)
else
( try
Arg.parse speclist
(fun s -> flag.env <- (List.append flag.env [s]))
usage
with
Failure(e) ->
print_string e;
flush stdout ;
flush stderr ;
exit 2
| _ ->
exit 2
);
try
let env_llist = (get_env_from_args 1 []) in
let env_llist = flag.env in
let g = read_env_state env_llist in
Show_env.graph_to_dot [] [] "environment"
(fun x -> x)
(Show_env.arc_to_string_trunc)
(Show_env.arc_to_string_trunc flag.max_size)
g;
Util.gv ("environment.ps")
with e ->
......
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