-
Notifications
You must be signed in to change notification settings - Fork 4
/
dot.mli
84 lines (61 loc) · 3.38 KB
/
dot.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(* Kaspar Rohrer, Wed Apr 14 02:20:31 CEST 2010 *)
(** Dumping arbitrary values in the Graphviz DOT language
Context objects are used to configure the dumping process. A
sensible [default_context] is already provided.
If you are on OS X and have Graphviz installed, you can try the
[Inspect.Dot.dump_osx] function to dump directly to a
temporary PDF file, which will then be opened in Preview. *)
type dot_attrs = (string * string) list
class type context_t =
object
method graph_attrs : dot_attrs
method all_nodes_attrs : dot_attrs
method all_edges_attrs : dot_attrs
method node_attrs : ?root:bool -> Obj.t -> dot_attrs
method edge_attrs : src:Obj.t -> field:int -> dst:Obj.t -> dot_attrs
method label_attrs : string -> dot_attrs
method label_edge_attrs : string -> dot_attrs
method should_inline : Obj.t -> bool
method should_follow_edge : src:Obj.t -> field:int -> dst:Obj.t -> bool
method max_fields_for_node : Obj.t -> int
end
(** The context is used to configure the dumping process *)
type follow = src:Obj.t -> field:int -> dst:Obj.t -> bool
(** Edge filter predicate *)
class context : ?max_fields: int -> ?follow:follow -> unit -> context_t
(** The default context class. *)
val default_context : context
(** Context with sensible default values, used as the default
argument for the [dump] function family. *)
val make_context : ?max_fields:int -> ?follow:follow -> unit -> context
(** Create a custom context. [max_fields] controls how many fields
should be expanded for block nodes. *)
val dump : ?context:context -> 'a -> unit
(** Dump to [stdout] *)
val dump_list : ?context:context -> (string * 'a) list -> unit
(** Same as {!dump} but for a list of labeled values.*)
val dump_to_file : ?context:context -> string -> 'a -> unit
(** Dump directly to a file. {b The file will be overwritten if it
already exists.} *)
val dump_list_to_file : ?context:context -> string -> (string * 'a) list -> unit
(** Same as {!dump_to_file} but for a list of labeled values.*)
val dump_with_formatter : ?context:context -> Format.formatter -> 'a -> unit
(** Dump using the [Format] module for pretty printing. *)
val dump_list_with_formatter : ?context:context -> Format.formatter -> (string * 'a) list -> unit
(** Same as {!dump_with_formatter} but for a list of labeled values.*)
val dump_and_open : ?context:context -> ?cmd:string -> format:string -> viewer:string -> 'a -> unit
(** [dump_and_open ?context ?cmd ~format ~viewer o] dumps the value [o] to a
temporary file, runs the Graphviz program given by [cmd] on it
to generate output as specified by [format], and then opens
the generated output with the [viewer] command.
E.g. [Inspect.Dot.dump_osx ~cmd:"neato" (Inspect.test_data ())]
This function will block while the graph is being generated. *)
val dump_list_and_open : ?context:context -> ?cmd:string ->
format:string -> viewer:string -> (string * 'a) list -> unit
(** Same as {!dump_and_open} but for a list of labeled values.*)
val dump_osx : ?context:context -> ?cmd:string -> 'a -> unit
(** Call {!val:dump_and_open} with [format] "pdf" and [viewer] "open". *)
val dump_list_osx : ?context:context -> ?cmd:string -> (string * 'a) list -> unit
(** Same as {!dump_osx} but for a list of labeled values.*)
val test_data : unit -> Obj.t
(** Generate test data to inspect *)