aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-03-05 21:47:12 +0100
committerPierre-Marie Pédrot2016-03-05 21:47:12 +0100
commitf8b624f7bec0406258eee4e08b0cec8d756da6ff (patch)
tree874c450f7d350455884d409bcfe6bafa44af7b47 /lib
parenteb0feed6d22c11c44e7091c64ce5b1c9d5af987a (diff)
parent32baedf7a3aebb96f7dd2c7d90a1aef40ed93792 (diff)
Merge branch 'v8.5'
Diffstat (limited to 'lib')
-rw-r--r--lib/cEphemeron.ml (renamed from lib/ephemeron.ml)0
-rw-r--r--lib/cEphemeron.mli (renamed from lib/ephemeron.mli)0
-rw-r--r--lib/future.ml8
-rw-r--r--lib/lib.mllib2
-rw-r--r--lib/unicode.ml7
-rw-r--r--lib/unicode.mli3
6 files changed, 15 insertions, 5 deletions
diff --git a/lib/ephemeron.ml b/lib/cEphemeron.ml
index a38ea11e10..a38ea11e10 100644
--- a/lib/ephemeron.ml
+++ b/lib/cEphemeron.ml
diff --git a/lib/ephemeron.mli b/lib/cEphemeron.mli
index 1200e4e208..1200e4e208 100644
--- a/lib/ephemeron.mli
+++ b/lib/cEphemeron.mli
diff --git a/lib/future.ml b/lib/future.ml
index ff16286c4f..9cdc1c20e3 100644
--- a/lib/future.ml
+++ b/lib/future.ml
@@ -63,7 +63,7 @@ and 'a comp =
| Exn of Exninfo.iexn (* Invariant: this exception is always "fixed" as in fix_exn *)
and 'a comput =
- | Ongoing of string * (UUID.t * fix_exn * 'a comp ref) Ephemeron.key
+ | Ongoing of string * (UUID.t * fix_exn * 'a comp ref) CEphemeron.key
| Finished of 'a
and 'a computation = 'a comput ref
@@ -71,13 +71,13 @@ and 'a computation = 'a comput ref
let unnamed = "unnamed"
let create ?(name=unnamed) ?(uuid=UUID.fresh ()) f x =
- ref (Ongoing (name, Ephemeron.create (uuid, f, Pervasives.ref x)))
+ ref (Ongoing (name, CEphemeron.create (uuid, f, Pervasives.ref x)))
let get x =
match !x with
| Finished v -> unnamed, UUID.invalid, id, ref (Val (v,None))
| Ongoing (name, x) ->
- try let uuid, fix, c = Ephemeron.get x in name, uuid, fix, c
- with Ephemeron.InvalidKey ->
+ try let uuid, fix, c = CEphemeron.get x in name, uuid, fix, c
+ with CEphemeron.InvalidKey ->
name, UUID.invalid, id, ref (Exn (NotHere name, Exninfo.null))
type 'a value = [ `Val of 'a | `Exn of Exninfo.iexn ]
diff --git a/lib/lib.mllib b/lib/lib.mllib
index a9181c51c1..2be435f6ff 100644
--- a/lib/lib.mllib
+++ b/lib/lib.mllib
@@ -14,6 +14,6 @@ Rtree
Heap
Unionfind
Genarg
-Ephemeron
+CEphemeron
Future
RemoteCounter
diff --git a/lib/unicode.ml b/lib/unicode.ml
index 05998bb804..938e8f1a99 100644
--- a/lib/unicode.ml
+++ b/lib/unicode.ml
@@ -173,6 +173,13 @@ let next_utf8 s i =
(c land 0x3F) lsl 6 + (d land 0x3F)
else err ()
+let is_utf8 s =
+ let rec check i =
+ let (off, _) = next_utf8 s i in
+ check (i + off)
+ in
+ try check 0 with End_of_input -> true | Invalid_argument _ -> false
+
(* Check the well-formedness of an identifier *)
let initial_refutation j n s =
diff --git a/lib/unicode.mli b/lib/unicode.mli
index 72d1f29504..b8a11e2945 100644
--- a/lib/unicode.mli
+++ b/lib/unicode.mli
@@ -36,3 +36,6 @@ val is_basic_ascii : string -> bool
translated to ["__Uxxxx_"] where {i xxxx} are four hexadecimal digits.
@raise Unsupported if the input string contains unsupported UTF-8 characters. *)
val ascii_of_ident : string -> string
+
+(** Validate an UTF-8 string *)
+val is_utf8 : string -> bool