Add a compact tree model.
[tatoo.git] / src / tatoo.ml
index 20bc903..5dec2f6 100644 (file)
@@ -50,7 +50,7 @@ let main () =
     | Some input ->
         let fd = open_in input in fd, fun () -> close_in fd
     in
-    let d = time Naive_tree.load_xml_file fd "parsing xml document" in
+    let d = time Compact_tree.load_xml_file fd "parsing xml document" in
     close_fd (); d
   in
   let queries =
@@ -104,10 +104,10 @@ let main () =
       Logger.msg `STATS "@[Automaton: @\n%a@]" Ata.print auto) auto_list;
   end;
 
-  let module Naive = Run.Make(Naive_tree)(Naive_node_list) in
+  let module Naive = Run.Make(Compact_tree)(Compact_node_list) in
   let result_list =
-    let root = Naive_node_list.create () in
-    let () = Naive_node_list.add (Naive_tree.root doc) root in
+    let root = Compact_node_list.create () in
+    let () = Compact_node_list.add (Compact_tree.root doc) root in
     let f, msg =
       match !Options.parallel, !Options.compose with
         true, true ->
@@ -138,11 +138,11 @@ let main () =
       output_string output (string_of_int !count);
       output_string output "\" >\n";
       if !Options.count then begin
-        output_string output (string_of_int (Naive_node_list.length results));
+        output_string output (string_of_int (Compact_node_list.length results));
         output_char output '\n';
       end else
-        Naive_node_list.iter (fun n ->
-          Naive_tree.print_xml output doc n;
+        Compact_node_list.iter (fun n ->
+            Compact_tree.print_xml output doc n;
           output_char output '\n'
         ) results;
       output_string output "</xml_result>\n";
@@ -166,4 +166,6 @@ let () =
           Some s -> ("file " ^ s)
         | None -> "[stdin]") msg; exit 3
   | Xpath.Ulexer.Error (s, e, msg) -> eprintf "Error: character %i-%i: %s\n%!" s e msg; exit 4
-  | e -> eprintf "FATAL ERROR: %s\n%!" (Printexc.to_string e); exit 128
+(*  | e -> Printexc.print_backtrace stderr;
+    flush stderr;
+    eprintf "FATAL ERROR: %s\n%!" (Printexc.to_string e); exit 128 *)