Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 124 lines (97 sloc) 3.586 kb
8634b74 initial import into fresh git repo.
pad authored
1 open Common
2
3 module Flag = Flag_program_visual
4
5 (*****************************************************************************)
6 (* Purpose *)
7 (*****************************************************************************)
8 (*
9 *)
10
11 (*****************************************************************************)
12 (* Flags *)
13 (*****************************************************************************)
14
15 (* There are a few settable flags in flags_program_visual.ml *)
16
17 (* action mode *)
18 let action = ref ""
19
20 let version = "0.1"
21
22 (*****************************************************************************)
23 (* Helpers *)
24 (*****************************************************************************)
25
26 (*****************************************************************************)
27 (* Main action *)
28 (*****************************************************************************)
29 let main_action dir =
30 raise Todo
31
32 (*****************************************************************************)
33 (* Extra actions *)
34 (*****************************************************************************)
35
36 let misc_extra_actions () = [
37 ]
38
39
40 (*****************************************************************************)
41 (* The options *)
42 (*****************************************************************************)
43
44 let all_actions () =
45 misc_extra_actions () ++
ea99ce2 moving a few files so that 'make dotall' can now work
pad authored
46 (*
8634b74 initial import into fresh git repo.
pad authored
47 Treemap_pl.actions () ++
48 Treemap_ex_pfff.actions () ++
ea99ce2 moving a few files so that 'make dotall' can now work
pad authored
49 *)
8634b74 initial import into fresh git repo.
pad authored
50 []
51
52 let options () =
53 Flag.cmdline_flags () ++
54 [
55 ] ++
56 Common.options_of_actions action (all_actions()) ++
57 Common.cmdline_flags_devel () ++
58 Common.cmdline_flags_verbose () ++
59 Common.cmdline_flags_other () ++
60 [
61 "-version", Arg.Unit (fun () ->
62 pr2 (spf "visual pl version: %s" version);
63 exit 0;
64 ),
65 " guess what";
66
67 (* this can not be factorized in Common *)
68 "-date", Arg.Unit (fun () ->
69 pr2 "version: $Date: 2008/10/26 00:44:57 $";
70 raise (Common.UnixExit 0)
71 ),
72 " guess what";
73 ] ++
74 []
75
76 (*****************************************************************************)
77 (* Main entry point *)
78 (*****************************************************************************)
79
80 let main () =
81 let usage_msg =
82 "Usage: " ^ Common.basename Sys.argv.(0) ^
83 " [options] <db> " ^ "\n" ^ "Options are:"
84 in
85 (* does side effect on many global flags *)
86 let args = Common.parse_options (options()) usage_msg Sys.argv in
87
88 (* must be done after Arg.parse, because Common.profile is set by it *)
89 Common.profile_code "Main total" (fun () ->
90
91 (match args with
92
93 (* --------------------------------------------------------- *)
94 (* actions, useful to debug subpart *)
95 (* --------------------------------------------------------- *)
96 | xs when List.mem !action (Common.action_list (all_actions())) ->
97 Common.do_action !action xs (all_actions())
98
99 | _ when not (Common.null_string !action) ->
100 failwith ("unrecognized action or wrong params: " ^ !action)
101
102 (* --------------------------------------------------------- *)
103 (* main entry *)
104 (* --------------------------------------------------------- *)
105 | [x] ->
106 main_action x
107
108 (* --------------------------------------------------------- *)
109 (* empty entry *)
110 (* --------------------------------------------------------- *)
111 | _ ->
112 Common.usage usage_msg (options());
113 failwith "too few arguments"
114 )
115 )
116
117
118 (*****************************************************************************)
119 let _ =
120 Common.main_boilerplate (fun () ->
121 main ();
122 )
123
Something went wrong with that request. Please try again.