Commit 2ad966db authored by bguillaum's avatar bguillaum
Browse files

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 ...@@ -58,7 +58,7 @@ module Rewrite_history = struct
loop true ([],[]) t; loop true ([],[]) t;
List.rev !nfs 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 let stats = ref [] in
...@@ -68,12 +68,15 @@ module Rewrite_history = struct ...@@ -68,12 +68,15 @@ module Rewrite_history = struct
let _ = Unix.system (sprintf "rm -f %s*.png" prefix) in let _ = Unix.system (sprintf "rm -f %s*.png" prefix) in
let nf_files = save_all_dep ?main_feat ~init_graph prefix t 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 let local = Filename.basename prefix in
(* All normal forms view *) (* All normal forms view *)
let html_ch = open_out (sprintf "%s.html" prefix) in 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 if init_graph
then then
......
...@@ -9,7 +9,7 @@ module Rewrite_history: sig ...@@ -9,7 +9,7 @@ module Rewrite_history: sig
bad_nf: Instance.t list; 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 end
......
...@@ -95,13 +95,13 @@ let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file ...@@ -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 _ = Grs.build_rew_display grs seq init in *)
let stats = let stats =
if no_init if no_init
then Some (Rewrite_history.save_html ?main_feat ~init_graph:false ~header:(Buffer.contents buff) ~title output rew_hist) 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) ~title output rew_hist) in else Some (Rewrite_history.save_html ?main_feat ~header:(Buffer.contents buff) output rew_hist) in
stats stats
with with
| Utils.Run (msg, Some (loc_file,loc_line)) -> | Utils.Run (msg, Some (loc_file,loc_line)) ->
let html_ch = open_out (sprintf "%s.html" output) in 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"; fprintf html_ch "<h6>Initial graph</h6>\n";
Instance.save_dep_png ?main_feat output init; 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); 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 ...@@ -114,7 +114,7 @@ let rewrite_to_html ?main_feat input_dir grs output_dir no_init current_grs_file
None None
| exc -> | exc ->
let html_ch = open_out (sprintf "%s.html" output) in 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); fprintf html_ch "<h1>UNEXPECTED EXCEPTION: %s</h1>" (Printexc.to_string exc);
Html.leave html_ch; Html.leave html_ch;
close_out 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