5 Ho | Abc | Abcx | Swfx | Swf
45 OptParser.make ~version:Config.version ~usage:"habc [options] <file>" ()
47 let str_option ~default ~metavar ?short_name ?long_name ~help () =
49 StdOpt.str_option ~default ~metavar () in
51 OptParser.add opt_parser
53 ?long_name ~help store in
57 x with Opt.option_metavars = []
60 let str_callback ?short_name ?long_name ~help f =
62 Opt.option_metavars = [];
63 option_defhelp = Some help;
64 option_get = (fun _ -> raise Opt.No_value);
65 option_set_value = (fun _ -> ());
66 option_set = (fun _ _ ->
70 OptParser.add opt_parser
75 let int_option ~default ~metavar ?short_name ?long_name ~help () =
77 StdOpt.int_option ~default ~metavar () in
79 OptParser.add opt_parser
80 ?short_name ?long_name ~help store in
83 let bool_option ~default ?short_name ?long_name ~help () =
88 StdOpt.store_false () in
90 OptParser.add opt_parser
91 ?short_name ?long_name ~help store in
95 str_callback ~long_name:"conf" ~help:"Print configure and exit"
97 Printf.printf "version: %s\n" @@ Std.dump Config.version;
98 Printf.printf "bin_dir: %s\n" @@ Std.dump Config.bin_dir;
99 Printf.printf "share_dir: %s\n" @@ Std.dump Config.share_dir;
100 Printf.printf "lib_dir: %s\n" @@ Std.dump Config.lib_dir;
101 Printf.printf "default_includes: %s\n" @@ Std.dump Config.default_includes;
102 Printf.printf "default_template: %s\n" @@ Std.dump Config.default_template;
103 Printf.printf "path_sep: %s\n" @@ Std.dump Config.path_sep;
104 Printf.printf "exe: %s\n" @@ Std.dump Config.exe;
110 ~default:(Config.bin_dir ^ "/habc-scm" ^ Config.exe)
113 ~help:"Use <cmd> to compile scm to abc" () in
119 ~help:"Add <dir ..> to the list of include directories" () in
124 ~help:"without std library" () in
126 Config.default_includes
127 +> List.filter Sys.file_exists
128 +> String.concat Config.path_sep in
130 scm_cmd = Opt.get cmd;
131 includes = default ^ Config.path_sep ^ Opt.get includes;
132 link_std = Opt.get no_std
138 ~default:(Config.bin_dir ^ "/habc-xml" ^ Config.exe)
141 ~help:"Use <cmd> to compile abc to abcx" () in
143 abc_cmd = Opt.get cmd
152 ~help:"Use <cmd> to compile abcx to swfx" () in
159 ~help:"Set stage width by pixel" () in
166 ~help:"Set stage height by pixel" () in
169 ~default:"rgb(134,156,167)"
172 ~help:"stage background color" () in
175 ~default:Config.default_template
176 ~metavar:"<tempalte>"
177 ~long_name:"template"
178 ~help:"swfx template" () in
180 abcx_cmd = Opt.get cmd;
181 bg_color = Color.parse @@ Opt.get bg_color;
182 size = (20 * Opt.get width,20 * Opt.get height); (* convert pixel to twips *)
183 template = Opt.get template;
192 ~help:"Use <cmd> to compile swfx to swf" () in
194 swfx_cmd = Opt.get cmd
203 ~help:"Print calls to external command" () in
208 ~long_name:"just-print"
209 ~help:"Don't actually run any commands; just print them" () in
214 ~long_name:"keep-files"
215 ~help:"Keep temporary files" () in
217 verbose = Opt.get verbose;
218 just_print = Opt.get just_print;
219 keep_files = Opt.get keep_files
225 ~default:false ~short_name:'c' ~help:"compile only" () in
228 ~default:false ~long_name:"abc-stage" ~help:"(no doc)" () in
231 ~default:false ~long_name:"abcx-stage" ~help:"(no doc)" () in
234 ~default:false ~long_name:"swfx-stage" ~help:"(no doc)" () in
238 else if Opt.get abc then
240 else if Opt.get abcx then
242 else if Opt.get swfx then
253 ~help:"Set output filename" () in
255 OptParser.parse_argv opt_parser in
258 OptParser.usage opt_parser ();
263 match output_type () with
272 general = general ();