1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Xavier Leroy, 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 (* Assign locations and numbers to globals and primitives *)
17
18 open Cmo_format
19
20 (* Functions for batch linking *)
21
22 val init: unit -> unit
23 val patch_object: Misc.LongString.t -> (reloc_info * int) list -> unit
24 val require_primitive: string -> unit
25 val initial_global_table: unit -> Obj.t array
26 val output_global_map: out_channel -> unit
27 val output_primitive_names: out_channel -> unit
28 val output_primitive_table: out_channel -> unit
29 val data_global_map: unit -> Obj.t
30 val data_primitive_names: unit -> string
31 val transl_const: Lambda.structured_constant -> Obj.t
32
33 (* Functions for the toplevel *)
34
35 val init_toplevel: unit -> (string * Digest.t option) list
36 val update_global_table: unit -> unit
37 val get_global_value: Ident.t -> Obj.t
38 val is_global_defined: Ident.t -> bool
39 val assign_global_value: Ident.t -> Obj.t -> unit
40 val get_global_position: Ident.t -> int
41 val check_global_initialized: (reloc_info * int) list -> unit
42 val defined_globals: (reloc_info * int) list -> Ident.t list
43 val required_globals: (reloc_info * int) list -> Ident.t list
44
45 type global_map
46
47 val empty_global_map: global_map
48 val current_state: unit -> global_map
49 val restore_state: global_map -> unit
50 val hide_additions: global_map -> unit
51 val filter_global_map: (Ident.t -> bool) -> global_map -> global_map
52 val iter_global_map : (Ident.t -> int -> unit) -> global_map -> unit
53 val is_defined_in_global_map: global_map -> Ident.t -> bool
54
55 (* Error report *)
56
57 type error =
58 Undefined_global of string
59 | Unavailable_primitive of string
60 | Wrong_vm of string
61 | Uninitialized_global of string
62
63 exception Error of error
64
65 open Format
66
67 val report_error: formatter -> error -> unit
68
69 val reset: unit -> unit
70