From: Stephane Glondu <steph@glondu.net>
Date: Wed, 16 Jun 2010 07:47:09 +0200
Subject: [PATCH] Cope with OCaml 3.12's Map
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585459
Signed-off-by: Stephane Glondu <steph@glondu.net>
---
c/cutil.ml | 19 ++++++++++++++++++-
c/cutil.mli | 23 ++++++++++++++++++++---
jc/jc_stdlib.ml | 15 ++++++++++++++-
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/c/cutil.ml b/c/cutil.ml
index c0969d9..3e7b01f 100644
--- a/c/cutil.ml
+++ b/c/cutil.ml
@@ -72,12 +72,29 @@ end
(* commonly used maps/sets based on std lib *)
+module type MAP = sig
+ type key
+ type +'a t
+ val empty : 'a t
+ val is_empty : 'a t -> bool
+ val mem : key -> 'a t -> bool
+ val add : key -> 'a -> 'a t -> 'a t
+ val remove : key -> 'a t -> 'a t
+ val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
+ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+ val iter : (key -> 'a -> unit) -> 'a t -> unit
+ val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+ val find : key -> 'a t -> 'a
+ val map : ('a -> 'b) -> 'a t -> 'b t
+ val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
+end
+
module StringSet = Set.Make (String)
module StringMap = Map.Make (String)
module Int32Map = Map.Make (Int32)
module Int32Set = Set.Make (Int32)
-module Int31Map : Map.S with type key = int =
+module Int31Map : MAP with type key = int =
struct
module M = Int32Map
let to32 f = fun i32 -> f (Int32.to_int i32)
diff --git a/c/cutil.mli b/c/cutil.mli
index 7c27a07..47d3866 100644
--- a/c/cutil.mli
+++ b/c/cutil.mli
@@ -47,11 +47,28 @@ module Pair : sig
: Set.OrderedType with type t = L1.t * L2.t
end
+module type MAP = sig
+ type key
+ type +'a t
+ val empty : 'a t
+ val is_empty : 'a t -> bool
+ val mem : key -> 'a t -> bool
+ val add : key -> 'a -> 'a t -> 'a t
+ val remove : key -> 'a t -> 'a t
+ val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
+ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+ val iter : (key -> 'a -> unit) -> 'a t -> unit
+ val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+ val find : key -> 'a t -> 'a
+ val map : ('a -> 'b) -> 'a t -> 'b t
+ val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
+end
+
module StringSet : Set.S with type elt = string
-module StringMap : Map.S with type key = string
-module Int32Map : Map.S with type key = int32
+module StringMap : MAP with type key = string
+module Int32Map : MAP with type key = int32
module Int32Set : Set.S with type elt = int32
-module Int31Map : Map.S with type key = int
+module Int31Map : MAP with type key = int
module Int31Set : Set.S with type elt = int
val list1 : 'a list -> 'a
diff --git a/jc/jc_stdlib.ml b/jc/jc_stdlib.ml
index 4efb55f..c9f58d8 100644
--- a/jc/jc_stdlib.ml
+++ b/jc/jc_stdlib.ml
@@ -93,7 +93,20 @@ module Map = struct
module type OrderedType = Map.OrderedType
module type S = sig
- include Map.S
+ type key
+ type +'a t
+ val empty : 'a t
+ val is_empty : 'a t -> bool
+ val mem : key -> 'a t -> bool
+ val add : key -> 'a -> 'a t -> 'a t
+ val remove : key -> 'a t -> 'a t
+ val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
+ val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+ val iter : (key -> 'a -> unit) -> 'a t -> unit
+ val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+ val find : key -> 'a t -> 'a
+ val map : ('a -> 'b) -> 'a t -> 'b t
+ val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val elements: 'a t -> (key * 'a) list
val keys: 'a t -> key list
val values: 'a t -> 'a list
--