Expose the internal structure of Hconsed value
[SXSI/xpathcomp.git] / tree.ml
diff --git a/tree.ml b/tree.ml
index 730e174..24fca56 100644 (file)
--- a/tree.ml
+++ b/tree.ml
@@ -358,6 +358,7 @@ let load ?(sample=64) str =
   let fd = Unix.openfile str [ Unix.O_RDONLY ] 0o644 in
   let in_c = Unix.in_channel_of_descr fd in
   let _ = set_binary_mode_in in_c true in
+  let load_table () = 
     (let ms = input_line in_c in if ms <> magic_string then failwith "Invalid index file");
     (let vs = input_line in_c in if vs <> version_string then failwith "Invalid version file");
     let table : (Tag.t,(Ptset.Int.t*Ptset.Int.t*Ptset.Int.t*Ptset.Int.t)) Hashtbl.t =
@@ -375,11 +376,15 @@ let load ?(sample=64) str =
       (* The in_channel read a chunk of fd, so we might be after
         the start of the XMLTree save file. Reset to the correct
         position *)
-      ignore(Unix.lseek fd (pos_in in_c) Unix.SEEK_SET);
-      let tree = { doc = tree_load fd;
-                  ttable = ntable;}
-      in close_in in_c;
-       tree
+      ntable
+  in
+  let _ = Printf.eprintf "\nLoading tag table : " in
+  let ntable = time (load_table) () in
+  ignore(Unix.lseek fd (pos_in in_c) Unix.SEEK_SET);
+  let tree = { doc = tree_load fd;
+              ttable = ntable;}
+  in close_in in_c;
+  tree