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
(* SPDX-License-Identifier: AGPL-3.0-or-later *)
(* Copyright © 2021-2026 OCamlPro *)
(* Written by the Owi programmers *)

module type T = sig
  type t

  type value

  type extern_func

  type modul

  type memory

  type table

  type elem

  type data

  type context

  val empty : context:context -> t

  val pp : t Fmt.t

  val get_last_module : env:t -> modul Result.t

  val register_module :
    env:t -> name:string -> modid:string option -> t Result.t

  val get_initialization_code : env:t -> modul:modul -> Binary.expr

  val link_binary_module :
    env:t -> name:string option -> modul:Binary.Module.t -> t Result.t

  (* TODO: the name should be removed and people should call register_module so we get a uniform API compared to link_binary module *)
  val link_extern_module :
    env:t -> name:string -> (string * extern_func) list -> t Result.t

  val get_memory : env:t -> int -> memory

  val set_memory : env:t -> int -> memory -> t

  val get_elem : env:t -> int -> elem

  val set_elem : env:t -> int -> elem -> t

  val get_table : env:t -> int -> table

  val set_table : env:t -> int -> table -> t

  val get_data : env:t -> int -> data

  val set_data : env:t -> int -> data -> t

  val get_global : env:t -> int -> value

  val set_global : env:t -> int -> value -> t

  val get_func : env:t -> int -> extern_func Kind.func

  val get_exported_func :
       env:t
    -> module_name:string option
    -> func_name:string
    -> extern_func Kind.func Result.t

  val get_exported_global :
    env:t -> module_name:string option -> global_name:string -> value Result.t

  val get_types : env:t -> Binary.sub_type array

  val get_type_groups : env:t -> (int * int) array

  val get_context : env:t -> context

  val get_modul_from_modid : env:t -> modid:string -> modul Result.t

  val default_gc_val : Binary.storage_type -> value
end