Flatten the sources, only leave the XPath module packed.
[tatoo.git] / src / misc.ml
diff --git a/src/misc.ml b/src/misc.ml
new file mode 100644 (file)
index 0000000..f8156b0
--- /dev/null
@@ -0,0 +1,51 @@
+(***********************************************************************)
+(*                                                                     *)
+(*                               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.                                                        *)
+(*                                                                     *)
+(***********************************************************************)
+
+(*
+  Time-stamp: <Last modified on 2013-03-04 23:00:19 CET by Kim Nguyen>
+*)
+
+(** 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 = T.find
+  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