[Stdlib] Rename Obj.Ephemeron.eph in .t

An ugly obj_t is needed for the shadowing of Obj.t
master
François Bobot 2015-12-01 13:44:48 +01:00
parent deb94edc0d
commit 9e85e6cb4d
3 changed files with 37 additions and 32 deletions

View File

@ -338,7 +338,7 @@ let obj_opt : Obj.t option -> 'a option = fun x -> Obj.magic x
module K1 = struct
type ('k,'d) t = ObjEph.eph
type ('k,'d) t = ObjEph.t
let create () : ('k,'d) t = ObjEph.create 1
@ -394,7 +394,7 @@ module K1 = struct
end
module K2 = struct
type ('k1, 'k2, 'd) t = ObjEph.eph
type ('k1, 'k2, 'd) t = ObjEph.t
let create () : ('k1,'k2,'d) t = ObjEph.create 1
@ -479,7 +479,7 @@ module K2 = struct
end
module Kn = struct
type ('k,'d) t = ObjEph.eph
type ('k,'d) t = ObjEph.t
let create n : ('k,'d) t = ObjEph.create n
let length (k:('k,'d) t) : int = ObjEph.length k

View File

@ -82,26 +82,28 @@ let extension_id (slot : extension_constructor) =
(obj (field (repr slot) 1) : int)
module Ephemeron = struct
type eph (** ephemeron *)
type obj_t = t
external create: int -> eph = "caml_ephe_create"
type t (** ephemeron *)
external create: int -> t = "caml_ephe_create"
let length x = size(repr x) - 2
external get_key: eph -> int -> t option = "caml_ephe_get_key"
external get_key_copy: eph -> int -> t option = "caml_ephe_get_key_copy"
external set_key: eph -> int -> t -> unit = "caml_ephe_set_key"
external unset_key: eph -> int -> unit = "caml_ephe_unset_key"
external check_key: eph -> int -> bool = "caml_ephe_check_key"
external blit_key : eph -> int -> eph -> int -> int -> unit
external get_key: t -> int -> obj_t option = "caml_ephe_get_key"
external get_key_copy: t -> int -> obj_t option = "caml_ephe_get_key_copy"
external set_key: t -> int -> obj_t -> unit = "caml_ephe_set_key"
external unset_key: t -> int -> unit = "caml_ephe_unset_key"
external check_key: t -> int -> bool = "caml_ephe_check_key"
external blit_key : t -> int -> t -> int -> int -> unit
= "caml_ephe_blit_key"
external get_data: eph -> t option = "caml_ephe_get_data"
external get_data_copy: eph -> t option = "caml_ephe_get_data_copy"
external set_data: eph -> t -> unit = "caml_ephe_set_data"
external unset_data: eph -> unit = "caml_ephe_unset_data"
external check_data: eph -> bool = "caml_ephe_check_data"
external blit_data : eph -> eph -> unit = "caml_ephe_blit_data"
external get_data: t -> obj_t option = "caml_ephe_get_data"
external get_data_copy: t -> obj_t option = "caml_ephe_get_data_copy"
external set_data: t -> obj_t -> unit = "caml_ephe_set_data"
external unset_data: t -> unit = "caml_ephe_unset_data"
external check_data: t -> bool = "caml_ephe_check_data"
external blit_data : t -> t -> unit = "caml_ephe_blit_data"
end

View File

@ -89,38 +89,41 @@ val unmarshal : bytes -> int -> t * int
module Ephemeron: sig
(** Ephemeron with arbitrary arity and untyped *)
type eph
type obj_t = t
(** alias for {!Obj.t} *)
type t
(** an ephemeron cf {!Ephemeron} *)
val create: int -> eph
val create: int -> t
(** [create n] returns an ephemeron with [n] keys.
All the keys and the data are initially empty *)
val length: eph -> int
val length: t -> int
(** return the number of keys *)
val get_key: eph -> int -> t option
val get_key: t -> int -> obj_t option
(** Same as {!Ephemeron.K1.get_key} *)
val get_key_copy: eph -> int -> t option
val get_key_copy: t -> int -> obj_t option
(** Same as {!Ephemeron.K1.get_key_copy} *)
val set_key: eph -> int -> t -> unit
val set_key: t -> int -> obj_t -> unit
(** Same as {!Ephemeron.K1.set_key} *)
val unset_key: eph -> int -> unit
val unset_key: t -> int -> unit
(** Same as {!Ephemeron.K1.unset_key} *)
val check_key: eph -> int -> bool
val check_key: t -> int -> bool
(** Same as {!Ephemeron.K1.check_key} *)
val blit_key : eph -> int -> eph -> int -> int -> unit
val blit_key : t -> int -> t -> int -> int -> unit
(** Same as {!Ephemeron.K1.blit_key} *)
val get_data: eph -> t option
val get_data: t -> obj_t option
(** Same as {!Ephemeron.K1.get_data} *)
val get_data_copy: eph -> t option
val get_data_copy: t -> obj_t option
(** Same as {!Ephemeron.K1.get_data_copy} *)
val set_data: eph -> t -> unit
val set_data: t -> obj_t -> unit
(** Same as {!Ephemeron.K1.set_data} *)
val unset_data: eph -> unit
val unset_data: t -> unit
(** Same as {!Ephemeron.K1.unset_data} *)
val check_data: eph -> bool
val check_data: t -> bool
(** Same as {!Ephemeron.K1.check_data} *)
val blit_data : eph -> eph -> unit
val blit_data : t -> t -> unit
(** Same as {!Ephemeron.K1.blit_data} *)
end