Merge branch 'local-ocamlbuild' into local-trunk
[SXSI/xpathcomp.git] / src / node.ml
diff --git a/src/node.ml b/src/node.ml
new file mode 100644 (file)
index 0000000..78f0899
--- /dev/null
@@ -0,0 +1,15 @@
+type 'a t = int
+
+
+let nil = ~-1
+let null = 0
+let is_nil x = x == ~-1
+let print fmt = Format.fprintf fmt "%i"
+
+let equal (x : 'a t) (y : 'a t) = x == y
+external ibool : bool -> int = "%identity"
+let compare (x : 'a t) (y : 'a t) = ibool (y > x) - ibool (y < x)
+let hash (x : 'a t) = x land 0x7fffffff
+
+external to_int : 'a t -> int = "%identity"
+external of_int : int -> 'a t = "%identity"