Added parsing of command line options to set sample factor, disabling storage
[SXSI/xpathcomp.git] / options.ml
1 let index_empty_texts = ref false
2 let sample_factor = ref 64
3 let disable_text_collection = ref false
4
5 let query = ref ""
6 let input_file = ref ""
7 let output_file = ref None
8
9
10 let usage_msg = Printf.sprintf "%s <input.xml> 'query' [output]" Sys.argv.(0)
11
12 let anon_fun = let pos = ref 0 in
13   fun s -> match !pos with
14     | 0 -> input_file:= s;incr pos
15     | 1 -> query := s; incr pos
16     | 2 -> output_file := Some s; incr pos
17     | _ -> raise (Arg.Bad(s))
18
19 let spec = [ "-f", Arg.Set_int(sample_factor),"sample factor [default=64]";
20              "-i", Arg.Set(index_empty_texts),"index empty texts [default=false]";
21              "-d", Arg.Set(disable_text_collection),"Disable text collection[default=false]"; ]
22
23 let parse_cmdline() = Arg.parse spec anon_fun usage_msg
24              
25