Commit 2ad966db authored by bguillaum's avatar bguillaum

add number of normal forms in html output

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@6486 7838e531-6607-4d57-9587-6c381814729c
parent 0f4f322f
......@@ -58,7 +58,7 @@ module Rewrite_history = struct
loop true ([],[]) t;
List.rev !nfs
let save_html ?main_feat ?(init_graph=true) ?title ?header prefix t =
let save_html ?main_feat ?(init_graph=true) ?header prefix t =
let stats = ref [] in
......@@ -68,12 +68,15 @@ module Rewrite_history = struct
let _ = Unix.system (sprintf "rm -f %s*.png" prefix) in
let nf_files = save_all_dep ?main_feat ~init_graph prefix t in
let l = List.length nf_files in
let local = Filename.basename prefix in
(* All normal forms view *)
let html_ch = open_out (sprintf "%s.html" prefix) in
let () = Html.enter html_ch ?title ?header prefix in
let title = sprintf "Sentence: %s --- %d Normal form%s" local l (if l>1 then "s" else "") in
let () = Html.enter html_ch ~title ?header prefix in
if init_graph
then
......
......@@ -9,7 +9,7 @@ module Rewrite_history: sig
bad_nf: Instance.t list;
}
val save_html: ?main_feat:string -> ?init_graph:bool -> ?title:string -> ?header:string -> string -> t -> (string*string list) list
val save_html: ?main_feat:string -> ?init_graph:bool -> ?header:string -> string -> t -> (string*string list) list
end
......
......@@ -95,13 +95,13 @@ let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file
(* let _ = Grs.build_rew_display grs seq init in *)
let stats =
if no_init
then Some (Rewrite_history.save_html ?main_feat ~init_graph:false ~header:(Buffer.contents buff) ~title output rew_hist)
else Some (Rewrite_history.save_html ?main_feat ~header:(Buffer.contents buff) ~title output rew_hist) in
then Some (Rewrite_history.save_html ?main_feat ~init_graph:false ~header:(Buffer.contents buff) output rew_hist)
else Some (Rewrite_history.save_html ?main_feat ~header:(Buffer.contents buff) output rew_hist) in
stats
with
| Utils.Run (msg, Some (loc_file,loc_line)) ->
let html_ch = open_out (sprintf "%s.html" output) in
let () = Html.enter html_ch ~title ~header:(Buffer.contents buff) output in
let () = Html.enter html_ch ~header:(Buffer.contents buff) output in
fprintf html_ch "<h6>Initial graph</h6>\n";
Instance.save_dep_png ?main_feat output init;
fprintf html_ch "<div width=100%% style=\"overflow-x:auto\"><IMG SRC=\"%s.png\"></div>\n" (Filename.basename output);
......@@ -114,7 +114,7 @@ let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file
None
| exc ->
let html_ch = open_out (sprintf "%s.html" output) in
let () = Html.enter html_ch ~title ~header:(Buffer.contents buff) output in
let () = Html.enter html_ch ~header:(Buffer.contents buff) output in
fprintf html_ch "<h1>UNEXPECTED EXCEPTION: %s</h1>" (Printexc.to_string exc);
Html.leave html_ch;
close_out html_ch;
......
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