File: analyze.mli

package info (click to toggle)
coq 8.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 30,604 kB
  • sloc: ml: 192,230; sh: 2,585; python: 2,206; ansic: 1,878; makefile: 818; lisp: 202; xml: 24; sed: 2
file content (50 lines) | stat: -rw-r--r-- 1,232 bytes parent folder | download
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
type data =
| Int of int
| Ptr of int
| Atm of int (* tag *)
| Fun of int (* address *)

type obj =
| Struct of int * data array (* tag × data *)
| String of string

module LargeArray :
sig
  type 'a t
  val empty : 'a t
  val length : 'a t -> int
  val make : int -> 'a -> 'a t
  val get : 'a t -> int -> 'a
  val set : 'a t -> int -> 'a -> unit
end
(** A data structure similar to arrays but allowing to overcome the 2^22 length
    limitation on 32-bit architecture. *)

val parse_channel : in_channel -> (data * obj LargeArray.t)
val parse_string : string -> (data * obj LargeArray.t)

(** {6 Functorized version} *)

module type Input =
sig
  type t
  val input_byte : t -> int
  (** Input a single byte *)
  val input_binary_int : t -> int
  (** Input a big-endian 31-bits signed integer *)
end
(** Type of inputs *)

module type S =
sig
  type input
  val parse : input -> (data * obj LargeArray.t)
  (** Return the entry point and the reification of the memory out of a
      marshalled structure. *)
end

module Make (M : Input) : S with type input = M.t
(** Functorized version of the previous code. *)

val instantiate : data * obj LargeArray.t -> Obj.t
(** Create the OCaml object out of the reified representation. *)