let version =
"0.4.1[2009-xx-xx]+auto-import"
+module OS = struct
+ let dir_sep =
+ if Sys.os_type = "Win32" then
+ ";"
+ else
+ ":"
+
+ let base =
+ Filename.dirname Sys.executable_name
+
+ let default_includes =
+ if Sys.os_type = "Win32" then
+ [Filename.concat base "./lib";"."]
+ else
+ [Filename.concat base "../lib/habc/";"."]
+
+ let default_template =
+ if Sys.os_type = "Win32" then
+ Filename.concat base "./template.xml"
+ else
+ Filename.concat base "../share/habc/template.xml"
+end
+
+open Base
open OptParse
-let (@@) f g = f g
-let ($) f g x = f (g x)
-let flip f x y = f y x
-let tee f x = try ignore (f x); x with _ -> x
-
-let default_template =
- let base =
- Filename.dirname Sys.executable_name in
- if Sys.os_type = "Win32" then
- Filename.concat base "./template.xml"
- else
- Filename.concat base "../share/habc/template.xml"
-
-
(* options *)
let opt_parser =
OptParser.make ~version:Config.version ~usage:"habc [options] <file>" ()
let template =
StdOpt.str_option
- ~default:default_template
+ ~default:Config.OS.default_template
~metavar:"TEMPLATE" ()
let output =
let inputs =
OptParser.parse_argv opt in
let includes =
- "." :: (Str.split (Str.regexp ":") @@ get_option include_dir) in
+ (Str.split (Str.regexp Config.OS.dir_sep) @@ get_option include_dir) @
+ Config.OS.default_includes in
if inputs = [] then begin
OptParser.usage opt ();
exit 0
let _ =
if not !Sys.interactive then
main ()
-
-