Commit 670548d5 authored by bguillaum's avatar bguillaum

version 0.24: adapt to new versions of libcaml-dep2pict and libcaml-leopar

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/grew/trunk@8814 7838e531-6607-4d57-9587-6c381814729c
parent 8cf5f6ff
...@@ -4,4 +4,4 @@ Bruno GUILLAUME is the main developer ...@@ -4,4 +4,4 @@ Bruno GUILLAUME is the main developer
Guillaume BONFANTE contributes to the first version of Grew Guillaume BONFANTE contributes to the first version of Grew
Guy PERRIER is the main developer of the linguistic resources Guy PERRIER is the main developer of the linguistic resources
Other people have contributed with ideas, code, resources: Mathieu MOREY, Paul MASSON, Floriant BESNARD. Other people have contributed with ideas, code, resources: Mathieu MOREY, Paul MASSON, Florian BESNARD.
VERSION = 0.23.2 VERSION = 0.24
INSTALL_DIR = @prefix@@bindir@ INSTALL_DIR = @prefix@@bindir@
DATA_DIR = @prefix@@datarootdir@/grew/ DATA_DIR = @prefix@@datarootdir@/grew/
......
...@@ -88,8 +88,11 @@ grew_cluster.cmx: grew_cluster.ml grew_args.cmx grew_utils.cmx grew_corpus.cmx ...@@ -88,8 +88,11 @@ grew_cluster.cmx: grew_cluster.ml grew_args.cmx grew_utils.cmx grew_corpus.cmx
grew_rew_display.cmx: grew_rew_display.ml grew_utils.cmx grew_rew_display.cmx: grew_rew_display.ml grew_utils.cmx
$(OCAMLOPT) -c unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.cmx grew_rew_display.ml ifeq (@USE_DEP2PICT@,yes)
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.cmx grew_rew_display.ml
else
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.cmx grew_rew_display.ml
endif
grew_utils.cmx: grew_utils.ml grew_args.cmx grew_utils.cmx: grew_utils.ml grew_args.cmx
ifeq (@USE_DEP2PICT@,yes) ifeq (@USE_DEP2PICT@,yes)
......
...@@ -275,9 +275,7 @@ let full () = ...@@ -275,9 +275,7 @@ let full () =
let grs = Libgrew.load_grs !Grew_args.grs in let grs = Libgrew.load_grs !Grew_args.grs in
(* get the list of graphs to explore *) (* get the list of graphs to explore *)
let graph_array = Array.map let graph_array = Array.of_list (Corpus.get_graphs !Grew_args.input_data) in
(fun (name, instance) -> (name, Libgrew.graph_of_instance instance))
(Array.of_list (Corpus.get_graphs !Grew_args.input_data)) in
let len = Array.length graph_array in let len = Array.length graph_array in
printf "MSG:%d graphs loaded from '%s'\n%!" len !Grew_args.input_data; printf "MSG:%d graphs loaded from '%s'\n%!" len !Grew_args.input_data;
......
...@@ -381,9 +381,8 @@ let init () = ...@@ -381,9 +381,8 @@ let init () =
match !Resources.current_gr with match !Resources.current_gr with
| None -> grew_window#btn_run#misc#set_sensitive false | None -> grew_window#btn_run#misc#set_sensitive false
| Some instance -> | Some graph ->
let _ = grew_window#btn_run#misc#set_sensitive true in let _ = grew_window#btn_run#misc#set_sensitive true in
let graph = Libgrew.graph_of_instance instance in
Grew_rew_display.graph_map := [("init", (graph, ("", "", None)))]; Grew_rew_display.graph_map := [("init", (graph, ("", "", None)))];
Grew_rew_display.current_top_graph := "init"; Grew_rew_display.current_top_graph := "init";
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
open Printf open Printf
open Grew_utils open Grew_utils
open Log open Log
open Dep2pict
let fos str = let fos str =
try float_of_string str try float_of_string str
...@@ -71,21 +70,37 @@ module Grew_rew_display = struct ...@@ -71,21 +70,37 @@ module Grew_rew_display = struct
let to_depfile_graph ?deco ?main_feat graph_id output_file = let to_depfile_graph ?deco ?main_feat graph_id output_file =
save output_file (to_depstring_graph ?deco ?main_feat graph_id) save output_file (to_depstring_graph ?deco ?main_feat graph_id)
let to_pdf_dotfile_graph ?deco ?main_feat graph_id output_file =
let dot = to_dotstring_graph ?deco ?main_feat graph_id in
Pdf.dot_to_file dot output_file
IFDEF DEP2PICT THEN
let to_pngfile_graph ?deco ?main_feat graph_id output_file = let to_pngfile_graph ?deco ?main_feat graph_id output_file =
let dep = to_depstring_graph ?deco ?main_feat graph_id in let dep = to_depstring_graph ?deco ?main_feat graph_id in
ignore(Dep2pict.fromDepStringToPng dep output_file) let d2p = Dep2pict.Dep2pict.from_dep ~dep in
Dep2pict.Dep2pict.save_png ~filename:output_file d2p
let to_pdf_depfile_graph ?deco ?main_feat graph_id output_file = let to_pdf_depfile_graph ?deco ?main_feat graph_id output_file =
let dep = to_depstring_graph ?deco ?main_feat graph_id in let dep = to_depstring_graph ?deco ?main_feat graph_id in
ignore(Dep2pict.fromDepStringToPdf dep output_file) let d2p = Dep2pict.Dep2pict.from_dep ~dep in
Dep2pict.Dep2pict.save_pdf ~filename:output_file d2p
let to_pdf_dotfile_graph ?deco ?main_feat graph_id output_file =
let dot = to_dotstring_graph ?deco ?main_feat graph_id in
Pdf.dot_to_file dot output_file
let to_svg_depfile_graph ?deco ?main_feat graph_id output_file = let to_svg_depfile_graph ?deco ?main_feat graph_id output_file =
let dep = to_depstring_graph ?deco ?main_feat graph_id in let dep = to_depstring_graph ?deco ?main_feat graph_id in
ignore(Dep2pict.fromDepStringToSvgFile dep output_file) let d2p = Dep2pict.Dep2pict.from_dep ~dep in
Dep2pict.Dep2pict.save_svg ~filename:output_file d2p
ELSE
let to_pngfile_graph ?deco ?main_feat graph_id output_file =
Log.critical "[to_pngfile_graph] not available without dep2pict"
let to_pdf_depfile_graph ?deco ?main_feat graph_id output_file =
Log.critical "[to_pdf_depfile_graph] is not available without dep2pict"
let to_svg_depfile_graph ?deco ?main_feat graph_id output_file =
Log.critical "[to_svg_depfile_graph] is not available without dep2pict"
END
let to_svg_dotfile_graph ?deco ?main_feat graph_id output_file = let to_svg_dotfile_graph ?deco ?main_feat graph_id output_file =
let dot = to_dotstring_graph ?deco ?main_feat graph_id in let dot = to_dotstring_graph ?deco ?main_feat graph_id in
...@@ -188,8 +203,8 @@ module Grew_rew_display = struct ...@@ -188,8 +203,8 @@ module Grew_rew_display = struct
begin begin
match rew_display with match rew_display with
| Libgrew.Empty -> () | Libgrew_types.Empty -> ()
| Libgrew.Leaf g -> | Libgrew_types.Leaf g ->
common_part "##end##" g; common_part "##end##" g;
incr graph_counter; incr graph_counter;
(match !first_leaf with (match !first_leaf with
...@@ -206,7 +221,7 @@ module Grew_rew_display = struct ...@@ -206,7 +221,7 @@ module Grew_rew_display = struct
); );
connect_up (); connect_up ();
| Libgrew.Local_normal_form (g,n,rd) -> | Libgrew_types.Local_normal_form (g,n,rd) ->
common_part n g; common_part n g;
let previous_node = !graph_counter in let previous_node = !graph_counter in
step (); step ();
...@@ -215,7 +230,7 @@ module Grew_rew_display = struct ...@@ -215,7 +230,7 @@ module Grew_rew_display = struct
connect_up (); connect_up ();
ignore(transform (string_of_int previous_node) true n rd (level+1)); ignore(transform (string_of_int previous_node) true n rd (level+1));
() ()
| Libgrew.Node (g,n,[]) -> | Libgrew_types.Node (g,n,[]) ->
common_part n g; common_part n g;
connect_up (); connect_up ();
...@@ -226,7 +241,7 @@ module Grew_rew_display = struct ...@@ -226,7 +241,7 @@ module Grew_rew_display = struct
incr graph_counter incr graph_counter
| Libgrew.Node (g,n,children) -> | Libgrew_types.Node (g,n,children) ->
common_part n g; common_part n g;
let previous_node = !graph_counter in let previous_node = !graph_counter in
...@@ -597,8 +612,8 @@ module Grew_rew_display = struct ...@@ -597,8 +612,8 @@ module Grew_rew_display = struct
(* let graph_counter_prefix = Str.global_replace (Str.regexp "G") "" first_graph_name in*) (* let graph_counter_prefix = Str.global_replace (Str.regexp "G") "" first_graph_name in*)
(* Log.fdebug "[Grew_rew_display] Father : %s | Son : %s" first_graph_name gr; *) (* Log.fdebug "[Grew_rew_display] Father : %s | Son : %s" first_graph_name gr; *)
let first_rule = bs.Libgrew.first in let first_rule = bs.Libgrew_types.first in
let steps = bs.Libgrew.small_step in let steps = bs.Libgrew_types.small_step in
(* Log.fdebug "[Grew_rew_display] First rule name : %s" first_rule.Libgrew.rule_name; *) (* Log.fdebug "[Grew_rew_display] First rule name : %s" first_rule.Libgrew.rule_name; *)
let dot = ref "digraph G {" in let dot = ref "digraph G {" in
...@@ -612,7 +627,7 @@ module Grew_rew_display = struct ...@@ -612,7 +627,7 @@ module Grew_rew_display = struct
add (Printf.sprintf " G%d [style=filled, fillcolor=\"%s\", label=G%d]" !graph_counter top_color !graph_counter); add (Printf.sprintf " G%d [style=filled, fillcolor=\"%s\", label=G%d]" !graph_counter top_color !graph_counter);
add (Printf.sprintf " node_mod_%d0 [fontcolor=transparent, color=transparent]" !graph_counter); add (Printf.sprintf " node_mod_%d0 [fontcolor=transparent, color=transparent]" !graph_counter);
add (Printf.sprintf " node_mod_%d1 [label=\"%s\", color=transparent]" !graph_counter (fix_rule_name first_rule.Libgrew.rule_name)); add (Printf.sprintf " node_mod_%d1 [label=\"%s\", color=transparent]" !graph_counter (fix_rule_name first_rule.Libgrew_types.rule_name));
add (Printf.sprintf " node_mod_%d0 -> node_mod_%d1 [fontcolor=transparent, color=transparent]" !graph_counter !graph_counter); add (Printf.sprintf " node_mod_%d0 -> node_mod_%d1 [fontcolor=transparent, color=transparent]" !graph_counter !graph_counter);
add (Printf.sprintf " {rank=same;node_mod_%d0; G%d}" !graph_counter !graph_counter); add (Printf.sprintf " {rank=same;node_mod_%d0; G%d}" !graph_counter !graph_counter);
incr graph_counter; incr graph_counter;
...@@ -635,7 +650,7 @@ module Grew_rew_display = struct ...@@ -635,7 +650,7 @@ module Grew_rew_display = struct
add (Printf.sprintf " G%d -> G%d" (!graph_counter-1) !graph_counter); add (Printf.sprintf " G%d -> G%d" (!graph_counter-1) !graph_counter);
add (Printf.sprintf " node_mod_%d0 [fontcolor=transparent, color=transparent]" !graph_counter); add (Printf.sprintf " node_mod_%d0 [fontcolor=transparent, color=transparent]" !graph_counter);
add (Printf.sprintf " node_mod_%d1 [label=\"%s\", color=transparent]" !graph_counter (fix_rule_name r.Libgrew.rule_name)); add (Printf.sprintf " node_mod_%d1 [label=\"%s\", color=transparent]" !graph_counter (fix_rule_name r.Libgrew_types.rule_name));
add (Printf.sprintf " node_mod_%d1 -> node_mod_%d0 [fontcolor=transparent, color=transparent]" (!graph_counter-1) !graph_counter); add (Printf.sprintf " node_mod_%d1 -> node_mod_%d0 [fontcolor=transparent, color=transparent]" (!graph_counter-1) !graph_counter);
add (Printf.sprintf " node_mod_%d0 -> node_mod_%d1 [fontcolor=transparent, color=transparent]" !graph_counter !graph_counter); add (Printf.sprintf " node_mod_%d0 -> node_mod_%d1 [fontcolor=transparent, color=transparent]" !graph_counter !graph_counter);
add (Printf.sprintf " {rank=same;node_mod_%d0; G%d}" !graph_counter !graph_counter); add (Printf.sprintf " {rank=same;node_mod_%d0; G%d}" !graph_counter !graph_counter);
...@@ -668,7 +683,7 @@ module Grew_rew_display = struct ...@@ -668,7 +683,7 @@ module Grew_rew_display = struct
let (gr,(gr_parent_name,rule)) = List.assoc graph !graph_map2 in let (gr,(gr_parent_name,rule)) = List.assoc graph !graph_map2 in
match rule with match rule with
| Some rule -> | Some rule ->
let up = rule.Libgrew.up and down = rule.Libgrew.down in let up = rule.Libgrew_types.up and down = rule.Libgrew_types.down in
current_bottom_deco := Some down; current_bottom_deco := Some down;
current_top_deco := Some up; current_top_deco := Some up;
...@@ -683,7 +698,7 @@ module Grew_rew_display = struct ...@@ -683,7 +698,7 @@ module Grew_rew_display = struct
then get_dot_graph_with_background2 ?main_feat ~deco:down ~botop:(true,false) graph then get_dot_graph_with_background2 ?main_feat ~deco:down ~botop:(true,false) graph
else get_dep_graph_with_background2 ?main_feat ~deco:down ~botop:(true,false) graph in else get_dep_graph_with_background2 ?main_feat ~deco:down ~botop:(true,false) graph in
let doc = Printf.sprintf "%s_%s.html" !current_selected_mod rule.Libgrew.rule_name in let doc = Printf.sprintf "%s_%s.html" !current_selected_mod rule.Libgrew_types.rule_name in
(svg_file_top,svg_file_bottom,gr_parent_name,doc) (svg_file_top,svg_file_bottom,gr_parent_name,doc)
| None -> failwith "get_rule_for" | None -> failwith "get_rule_for"
end end
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
open Printf open Printf
open Log open Log
IFDEF DEP2PICT THEN
open Dep2pict
ENDIF
open Grew_args open Grew_args
(* ================================================================================ *) (* ================================================================================ *)
...@@ -174,7 +178,8 @@ module Svg = struct ...@@ -174,7 +178,8 @@ module Svg = struct
IFDEF DEP2PICT THEN IFDEF DEP2PICT THEN
let dep_to_tmp dep = let dep_to_tmp dep =
let temp_file_name = Filename.temp_file "grew_" ".svg" in let temp_file_name = Filename.temp_file "grew_" ".svg" in
ignore (Dep2pict.Dep2pict.fromDepStringToSvgFile dep temp_file_name); let d2p = Dep2pict.from_dep ~dep in
let () = Dep2pict.save_svg ~filename:temp_file_name d2p in
temp_file_name temp_file_name
ELSE ELSE
let dep_to_tmp dep = let dep_to_tmp dep =
......
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