(***********************************************************************) (* *) (* TAToo *) (* *) (* Kim Nguyen, LRI UMR8623 *) (* Université Paris-Sud & CNRS *) (* *) (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *) (* Recherche Scientifique. All rights reserved. This file is *) (* distributed under the terms of the GNU Lesser General Public *) (* License, with the special exception on linking described in file *) (* ../LICENSE. *) (* *) (***********************************************************************) (** Various generic signatures and generic module and functor definitions *) INCLUDE "utils.ml" module HashSet (H : Hashtbl.HashedType) : Common_sig.HashSet with type data = H.t = struct module T = Hashtbl.Make(H) type data = H.t type t = data T.t let create = T.create let add h v = T.add h v v let find h v = T.find h v let remove = T.remove let find_all = T.find_all let clear = T.clear let mem = T.mem end module Pair (X : Common_sig.Type) (Y : Common_sig.Type) : Common_sig.Type with type t = X.t * Y.t = struct type t = X.t * Y.t let hash (x, y) = HASHINT2(X.hash x, Y.hash y) let compare (x1, y1) (x2, y2) = let r = X.compare x1 x2 in if r != 0 then r else Y.compare y1 y2 let equal p1 p2 = p1 == p2 || let x1, y1 = p1 and x2, y2 = p2 in X.equal x1 x2 && Y.equal y1 y2 end external int_of_bool : bool -> int = "%identity"