Fix a nasty bug where the wrong pointer was passed to the C side.
[SXSI/xpathcomp.git] / src / lextest.ml
index 0c297ca..77701cb 100644 (file)
@@ -2,7 +2,8 @@
 
 type index
 
-external build_lex_index : Tree.t -> Tag.t -> index = "caml_build_lex_index"
+external build_lex_index : Tree.tree_pointer -> Tag.t -> index = "caml_build_lex_index"
+
 external print_lex_index : index -> unit = "caml_print_lex_index"
 
 
@@ -20,8 +21,9 @@ let main () =
     else
     let () = Printf.eprintf "Error: unrecognized extension" in exit 2
   in
-  Printf.printf "Building lex index\n%!";
-  let index = build_lex_index document (Tag.tag Sys.argv.(2)) in
+  Tag.init (Tree.tag_operations document);
+  Printf.printf "Building lex index for tag %s\n%!" (Tag.to_string (Tag.tag Sys.argv.(2)));
+  let index = build_lex_index (Tree.get_tree_pointer document) (Tag.tag Sys.argv.(2)) in
   Printf.printf "Printing lex index\n%!";
   print_lex_index index;
   exit 0