projects
/
tatoo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.nguyen.vg/tatoo
[tatoo.git]
/
src
/
hcons.ml
diff --git
a/src/hcons.ml
b/src/hcons.ml
index
d421d03
..
cc7327a
100644
(file)
--- a/
src/hcons.ml
+++ b/
src/hcons.ml
@@
-13,45
+13,27
@@
(* *)
(***********************************************************************)
(* *)
(***********************************************************************)
-module type Abstract =
- sig
- type data
- type t
- val make : data -> t
- val node : t -> data
- val hash : t -> int
- val uid : t -> Uid.t
- val equal : t -> t -> bool
- val init : unit -> unit
- end
+(*
+ Time-stamp: <Last modified on 2013-03-18 00:16:08 CET by Kim Nguyen>
+*)
-type 'a node = { id : Uid.t;
- key : int;
- node : 'a }
-module type S =
-sig
- type data
- type t = private { id : Uid.t;
- key : int;
- node : data }
- include Abstract with type data := data and type t := t
-end
+include Hcons_sig
module type TableBuilder =
functor
module type TableBuilder =
functor
- (H :
Sigs
.HashedType) ->
-
Sigs
.HashSet with type data = H.t
+ (H :
Common_sig
.HashedType) ->
+
Common_sig
.HashSet with type data = H.t
-module Builder (TB : TableBuilder) (H :
Sigs
.HashedType) =
+module Builder (TB : TableBuilder) (H :
Common_sig
.HashedType) =
struct
type data = H.t
type t = { id : Uid.t;
struct
type data = H.t
type t = { id : Uid.t;
-
key
: int;
+
hash
: int;
node : data }
let uid_make = ref (Uid.make_maker())
let node t = t.node
let uid t = t.id
node : data }
let uid_make = ref (Uid.make_maker())
let node t = t.node
let uid t = t.id
- let hash t = t.
key
+ let hash t = t.
hash
let equal t1 t2 = t1 == t2
module HN =
struct
let equal t1 t2 = t1 == t2
module HN =
struct
@@
-66,9
+48,10
@@
struct
let init () =
T.clear pool;
uid_make := Uid.make_maker ()
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 make x =
- let cell =
{ id = Uid.dummy; key = H.hash x; node = x }
in
+ let cell =
dummy x
in
try
T.find pool cell
with
try
T.find pool cell
with
@@
-78,7
+61,7
@@
struct
cell
end
cell
end
-module Make = Builder (
Utils
.HashSet)
+module Make = Builder (
Misc
.HashSet)
module Weak = Builder (Weak.Make)
module PosInt =
module Weak = Builder (Weak.Make)
module PosInt =
@@
-88,9
+71,14
@@
struct
let make v =
if v < 0 then raise (Invalid_argument "Hcons.PosInt.make")
else v
let make v =
if v < 0 then raise (Invalid_argument "Hcons.PosInt.make")
else v
+
let node v = v
let node v = v
+
let hash v = v
let hash v = v
+
let uid v = Uid.of_int v
let uid v = Uid.of_int v
+ let dummy _ = ~-1
let equal x y = x == y
let equal x y = x == y
+
let init () = ()
end
let init () = ()
end