Add a new option to choose tree model at runtime.
[tatoo.git] / src / options.ml
index b8c5730..c303c80 100644 (file)
@@ -7,30 +7,38 @@ let queries = ref []
 let stats = ref false
 let compose = ref false
 let parallel = ref false
+let supported_models = [ "naive", (module Naive_tree : Tree.S);
+                         "compact",(module Compact_tree : Tree.S);
+                       ]
+let tree_model = ref  (fst (List.hd supported_models))
+let set_model s = tree_model := s
 
 let set_string_option r s = r := Some s
 
 let specs = align [
   "-c", Set count,
-        " write the number of results only";
+        "  write the number of results only";
   "--count", Set count, " ";
   "-s", Set stats,
-        " display timing and various statistics";
+        "  display timing and various statistics";
   "--stats", Set stats, " ";
   "-d", String (set_string_option input_file),
-        " specify the input document file [default stdin]";
+        "  specify the input document file [default stdin]";
   "--doc", String (set_string_option input_file), " ";
   "-o", String (set_string_option output_file),
-        " specify the output file [default stdout]";
+        "  specify the output file [default stdout]";
   "--out", String (set_string_option output_file), " ";
   "-C", Set compose,
-        " compose queries: each query is applied to the results of the \
+        "  compose queries: each query is applied to the results of the \
 previous one [default run all queries from the root node]";
   "--compose", Set compose, " ";
   "-p", Set parallel,
-        " run all queries in parallel [default run all queries \
+        "  run all queries in parallel [default run all queries \
 sequentially]";
   "--parallel", Set parallel, " ";
+  "-m", Symbol (List.map fst supported_models, set_model),
+  "  specify tree model (naive or compact, default to naive)";
+  "--model", Symbol (List.map fst supported_models, set_model), " ";
 ]
 
 let usage_msg =