1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Jerome Vouillon, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. *)
9 (* *)
10 (* All rights reserved. This file is distributed under the terms of *)
11 (* the GNU Lesser General Public License version 2.1, with the *)
12 (* special exception on linking described in the file LICENSE. *)
13 (* *)
14 (**************************************************************************)
15
16 (* Printing of values *)
17
18 open Types
19 open Format
20
21 module type OBJ =
22 sig
23 type t
24 val repr : 'a -> t
25 val obj : t -> 'a
26 val is_block : t -> bool
27 val tag : t -> int
28 val size : t -> int
29 val field : t -> int -> t
30 val double_array_tag : int
31 val double_field : t -> int -> float
32 end
33
34 module type EVALPATH =
35 sig
36 type valu
37 val eval_address: Env.address -> valu
38 exception Error
39 val same_value: valu -> valu -> bool
40 end
41
42 type ('a, 'b) gen_printer =
43 | Zero of 'b
44 | Succ of ('a -> ('a, 'b) gen_printer)
45
46 module type S =
47 sig
48 type t
49 val install_printer :
50 Path.t -> Types.type_expr -> (formatter -> t -> unit) -> unit
51 val install_generic_printer :
52 Path.t -> Path.t ->
53 (int -> (int -> t -> Outcometree.out_value,
54 t -> Outcometree.out_value) gen_printer) ->
55 unit
56 val install_generic_printer' :
57 Path.t -> Path.t ->
58 (formatter -> t -> unit,
59 formatter -> t -> unit) gen_printer ->
60 unit
61 (** [install_generic_printer' function_path constructor_path printer]
62 function_path is used to remove the printer. *)
63
64 val remove_printer : Path.t -> unit
65 val outval_of_untyped_exception : t -> Outcometree.out_value
66 val outval_of_value :
67 int -> int ->
68 (int -> t -> Types.type_expr -> Outcometree.out_value option) ->
69 Env.t -> t -> type_expr -> Outcometree.out_value
70 end
71
72 module Make(O : OBJ)(_ : EVALPATH with type valu = O.t) :
73 (S with type t = O.t)
74