diff --git a/Makefile b/Makefile index 81b8bacc777f6802246784a2eddd3383717f7d7b..3c5faa0f1882b45cde66d40bf2482ce602b392cb 100644 --- a/Makefile +++ b/Makefile @@ -722,12 +722,24 @@ GENERATED+=src/plugins/gui/gtk_compat.ml ifeq ($(HAS_DGRAPH),yes) DGRAPHFILES:=debug_manager - src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.yes.ml - $(CP) $< $@ + GENERATED+=src/plugins/gui/debug_manager.ml + ifeq ($(HAS_OCAMLGRAPH_2), yes) + DGRAPH_MODULE=Graph_gtk + DGRAPH_ERROR=Graph_gtk.DGraphMake.DotError + else + DGRAPH_MODULE=Dgraph + DGRAPH_ERROR=Dgraph.DGraphModel.DotError + endif + src/plugins/gui/debug_manager.ml \ + src/plugins/gui/dgraph_helper.ml \ + src/plugins/callgraph/cg_viewer.ml: %.ml: %.yes.ml Makefile + $(RM) $@ + $(SED) -e 's/DGRAPH_MODULE/$(DGRAPH_MODULE)/g' \ + -e 's/DGRAPH_ERROR/$(DGRAPH_ERROR)/g' $< > $@ $(CHMOD_RO) $@ else DGRAPHFILES:= - src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.no.ml + src/plugins/gui/dgraph_helper.ml: src/plugins/gui/dgraph_helper.no.ml Makefile $(CP) $< $@ $(CHMOD_RO) $@ endif @@ -794,6 +806,7 @@ PLUGIN_DIR:=src/plugins/callgraph PLUGIN_CMO:= options journalize subgraph cg services uses register ifeq ($(HAS_DGRAPH),yes) PLUGIN_GUI_CMO:=cg_viewer +PLUGIN_GENERATED:=$(PLUGIN_DIR)/cg_viewer.ml else PLUGIN_GUI_CMO:= PLUGIN_DISTRIB_EXTERNAL:=cg_viewer.ml diff --git a/src/plugins/callgraph/cg_viewer.ml b/src/plugins/callgraph/cg_viewer.yes.ml similarity index 99% rename from src/plugins/callgraph/cg_viewer.ml rename to src/plugins/callgraph/cg_viewer.yes.ml index 2d314d42fa52d7076b11bc8ce746d6a5be8ed1cc..d29b123e0cbc76b13a5a75ad2b2a69ef1897c008 100644 --- a/src/plugins/callgraph/cg_viewer.ml +++ b/src/plugins/callgraph/cg_viewer.yes.ml @@ -20,7 +20,7 @@ (* *) (**************************************************************************) -open Dgraph +open DGRAPH_MODULE let ($) f x = f x diff --git a/src/plugins/gui/debug_manager.ml b/src/plugins/gui/debug_manager.yes.ml similarity index 97% rename from src/plugins/gui/debug_manager.ml rename to src/plugins/gui/debug_manager.yes.ml index 3ae5cdd11d46cc172fdf75e78bb579f8635625dc..32eb2f1965f43ca1d812787c1f350caccbb754dc 100644 --- a/src/plugins/gui/debug_manager.ml +++ b/src/plugins/gui/debug_manager.yes.ml @@ -20,9 +20,9 @@ (* *) (**************************************************************************) -(* Require Dgraph included in Ocamlgraph, thus GnomeCanvas *) +(* Require Dgraph included in OCamlgraph/Ocamlgraph_gtk, thus GnomeCanvas *) -open Dgraph +open DGRAPH_MODULE let graph_view ~packing mk_dot = let f = diff --git a/src/plugins/gui/dgraph_helper.yes.ml b/src/plugins/gui/dgraph_helper.yes.ml index 30fa88ec14d5b77eeae769521ac859bb7d8ec37d..f547f895cb8bb737ed10b9421b0db40f7a8cd064 100644 --- a/src/plugins/gui/dgraph_helper.yes.ml +++ b/src/plugins/gui/dgraph_helper.yes.ml @@ -20,6 +20,8 @@ (* *) (**************************************************************************) +open DGRAPH_MODULE + let graph_window ~parent ~title make_view = let height = int_of_float (float parent#default_height *. 3. /. 4.) in let width = int_of_float (float parent#default_width *. 3. /. 4.) in @@ -46,13 +48,13 @@ let graph_window_through_dot ~parent ~title dot_formatter = Format.pp_print_flush fmt (); let view = snd - (Dgraph.DGraphContainer.Dot.from_dot_with_commands ~packing temp_file) + (DGraphContainer.Dot.from_dot_with_commands ~packing temp_file) in view in try graph_window ~parent ~title make_view - with Dgraph.DGraphModel.DotError _ as exn -> + with DGRAPH_ERROR _ as exn -> Gui_parameters.error "@[cannot display dot graph:@ %s@]" (Printexc.to_string exn)