ajout Weak.check
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2181 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
39e3dd6ee4
commit
4256d1ff60
|
@ -23,6 +23,8 @@ external set : 'a t -> int -> 'a option -> unit = "weak_set";;
|
||||||
|
|
||||||
external get: 'a t -> int -> 'a option = "weak_get";;
|
external get: 'a t -> int -> 'a option = "weak_get";;
|
||||||
|
|
||||||
|
external check: 'a t -> int -> bool = "weak_check";;
|
||||||
|
|
||||||
let fill ar ofs len x =
|
let fill ar ofs len x =
|
||||||
if ofs < 0 || ofs + len > length ar
|
if ofs < 0 || ofs + len > length ar
|
||||||
then raise (Invalid_argument "Weak.fill")
|
then raise (Invalid_argument "Weak.fill")
|
||||||
|
|
|
@ -42,6 +42,11 @@ val get : 'a t -> int -> 'a option;;
|
||||||
Raise [Invalid_argument "Weak.get"] if [n] is not in the range
|
Raise [Invalid_argument "Weak.get"] if [n] is not in the range
|
||||||
0 to [Weak.length a - 1].
|
0 to [Weak.length a - 1].
|
||||||
*)
|
*)
|
||||||
|
val check: 'a t -> int -> bool;;
|
||||||
|
(* [Weak.check ar n] returns [true] if the [n]th cell of [ar] is
|
||||||
|
full, [false] if it is empty. Note that even if [Weak.check ar n]
|
||||||
|
returns [true], a subsequent [Weak.get ar n] can return [None].
|
||||||
|
*)
|
||||||
val fill: 'a t -> int -> int -> 'a option -> unit;;
|
val fill: 'a t -> int -> int -> 'a option -> unit;;
|
||||||
(* [Weak.fill ar ofs len el] sets to [el] all pointers of [ar] from
|
(* [Weak.fill ar ofs len el] sets to [el] all pointers of [ar] from
|
||||||
[ofs] to [ofs + len - 1]. Raise [Invalid_argument "Weak.fill"]
|
[ofs] to [ofs + len - 1]. Raise [Invalid_argument "Weak.fill"]
|
||||||
|
|
Loading…
Reference in New Issue