diff options
Diffstat (limited to 'ocamldoc/odoc_dot.ml')
-rw-r--r-- | ocamldoc/odoc_dot.ml | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/ocamldoc/odoc_dot.ml b/ocamldoc/odoc_dot.ml index 877a84b913..452bf2bfa7 100644 --- a/ocamldoc/odoc_dot.ml +++ b/ocamldoc/odoc_dot.ml @@ -11,7 +11,7 @@ (* $Id$ *) -(** Definition of a class which outputs a dot file showing +(** Definition of a class which outputs a dot file showing top modules dependencies.*) open Odoc_info @@ -32,7 +32,7 @@ class dot = val mutable colors = !Args.dot_colors (** Graph header. *) - method header = + method header = "digraph G {\n"^ " size=\"10,7.5\";\n"^ " ratio=\"fill\";\n"^ @@ -43,14 +43,14 @@ class dot = method get_one_color = match colors with [] -> None - | h :: q -> + | h :: q -> colors <- q ; Some h method node_color s = try Some (List.assoc s loc_colors) with - Not_found -> + Not_found -> match self#get_one_color with None -> None | Some c -> @@ -71,10 +71,10 @@ class dot = F.fprintf fmt "\"%s\" -> \"%s\";\n" src dest method generate_for_module fmt m = - let l = List.filter - (fun n -> - !Args.dot_include_all or - (List.exists (fun m -> m.Module.m_name = n) modules)) + let l = List.filter + (fun n -> + !Args.dot_include_all or + (List.exists (fun m -> m.Module.m_name = n) modules)) m.Module.m_top_deps in self#print_module_atts fmt m; @@ -91,9 +91,9 @@ class dot = let oc = open_out !Args.out_file in let fmt = F.formatter_of_out_channel oc in F.fprintf fmt "%s" self#header; - let graph = Odoc_info.Dep.deps_of_types + let graph = Odoc_info.Dep.deps_of_types ~kernel: !Args.dot_reduce - types + types in List.iter (self#generate_for_type fmt) graph; F.fprintf fmt "}\n" ; @@ -103,14 +103,14 @@ class dot = Sys_error s -> raise (Failure s) - method generate_modules modules_list = + method generate_modules modules_list = try modules <- modules_list ; let oc = open_out !Args.out_file in let fmt = F.formatter_of_out_channel oc in F.fprintf fmt "%s" self#header; - if !Args.dot_reduce then + if !Args.dot_reduce then Odoc_info.Dep.kernel_deps_of_modules modules_list; List.iter (self#generate_for_module fmt) modules_list; @@ -123,6 +123,7 @@ class dot = (** Generate the dot code in the file {!Odoc_info.Args.out_file}. *) method generate (modules_list : Odoc_info.Module.t_module list) = + colors <- !Args.dot_colors; if !Args.dot_types then self#generate_types (Odoc_info.Search.types modules_list) else |