merge from branch stable-succint-jumping
[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 let save_file = ref ""
9 let count_only = ref false
10 let time = ref false
11
12 let usage_msg = Printf.sprintf "%s <input.{xml|srx}> 'query' [output]" Sys.argv.(0)
13
14
15 let pos = ref 0
16 let anon_fun = 
17   fun s -> match !pos with
18     | 0 -> input_file:= s;incr pos
19     | 1 -> query := s; incr pos
20     | 2 -> output_file := Some s; incr pos
21     | _ -> raise (Arg.Bad(s))
22
23 let spec = [ "-c", Arg.Set(count_only), "counting only (don't materialize the result set)";
24              "-t", Arg.Set(time), "print timing statistics";
25              "-f", Arg.Set_int(sample_factor), "sample factor [default=64]";
26              "-i", Arg.Set(index_empty_texts), "index empty texts [default=false]";
27              "-d", Arg.Set(disable_text_collection), "disable text collection[default=false]"; 
28              "-s", Arg.Set_string(save_file), "save the intermediate representation into file.srx"; 
29            ]
30
31 let parse_cmdline() = 
32   let _ = Arg.parse spec anon_fun usage_msg
33   in
34     if (!pos > 3 || !pos < 2)
35     then begin Arg.usage spec usage_msg; exit 1 end
36
37       
38              
39