X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Futils%2Fhcons.ml;fp=src%2Futils%2Fhcons.ml;h=0000000000000000000000000000000000000000;hp=3fc3e71a9de341af365f327cab962a3df0b99ef5;hb=b00bff88c7902e828804c06b7f9dc55222fdc84e;hpb=03b6a364e7240ca827585e7baff225a0aaa33bc6 diff --git a/src/utils/hcons.ml b/src/utils/hcons.ml deleted file mode 100644 index 3fc3e71..0000000 --- a/src/utils/hcons.ml +++ /dev/null @@ -1,84 +0,0 @@ -(***********************************************************************) -(* *) -(* 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: -*) - -include Hcons_sig - -module type TableBuilder = - functor - (H : Common_sig.HashedType) -> - Common_sig.HashSet with type data = H.t - -module Builder (TB : TableBuilder) (H : Common_sig.HashedType) = -struct - type data = H.t - type t = { id : Uid.t; - hash : int; - node : data } - let uid_make = ref (Uid.make_maker()) - let node t = t.node - let uid t = t.id - let hash t = t.hash - let equal t1 t2 = t1 == t2 - module HN = - struct - type _t = t - type t = _t - let hash = hash - let equal x y = x == y || H.equal x.node y.node - end - module T = TB(HN) - - let pool = T.create 101 - let init () = - T.clear pool; - uid_make := Uid.make_maker () - let dummy x = { id = Uid.dummy; hash = H.hash x; node = x } - - let make x = - let cell = { id = Uid.dummy; hash = H.hash x; node = x } in - try - T.find pool cell - with - | Not_found -> - let cell = { cell with id = !uid_make(); } in - T.add pool cell; - cell -end - -module Make = Builder (Misc.HashSet) -module Weak = Builder (Weak.Make) - -module PosInt = -struct - type data = int - type t = int - let make v = - if v < 0 then raise (Invalid_argument "Hcons.PosInt.make") - else v - - let node v = v - - let hash v = v - - let uid v = Uid.of_int v - let dummy _ = ~-1 - let equal x y = x == y - - let init () = () -end