Add serialization functions
[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
10 let usage_msg = Printf.sprintf "%s <input.xml> 'query' [output]" Sys.argv.(0)
11
12
13 let pos = ref 0
14 let anon_fun = 
15   fun s -> match !pos with
16     | 0 -> input_file:= s;incr pos
17     | 1 -> query := s; incr pos
18     | 2 -> output_file := Some s; incr pos
19     | _ -> raise (Arg.Bad(s))
20
21 let spec = [ "-f", Arg.Set_int(sample_factor),"sample factor [default=64]";
22              "-i", Arg.Set(index_empty_texts),"index empty texts [default=false]";
23              "-d", Arg.Set(disable_text_collection),"Disable text collection[default=false]"; 
24              "-s", Arg.Set_string(save_file),"Save the intermediate representation into file.srx"; 
25            ] 
26
27 let parse_cmdline() = 
28   let _ = Arg.parse spec anon_fun usage_msg
29   in
30     if (!pos > 3 || !pos < 2)
31     then begin Arg.usage spec usage_msg; exit 1 end
32
33       
34              
35