Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more system tags when selecting a monotonic clock #8

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions lib/monotonic_clock/select/select.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ let sexp_empty = "()"

let () =
let system, output =
try
match Sys.argv with
| [|_; "--system"; system; "-o"; output|] ->
let system =
match system with
| "linux" -> `Linux
| "freebsd" -> `FreeBSD
| "windows" | "mingw64" | "cygwin" -> `Windows
| "macosx" -> `MacOSX
| v -> invalid_arg "Invalid argument of system option: %s" v
in
(system, output)
| _ -> invalid_arg "%s --system system -o <output>" Sys.argv.(0)
with _ -> invalid_arg "%s --system system -o <output>, got %s" Sys.argv.(0)
(String.concat " " (Array.to_list Sys.argv))
match Sys.argv with
| [|_; "--system"; system; "-o"; output|] ->
let system =
match system with
| "linux" | "linux_eabihf" | "linux_elf" | "elf" -> `Linux
| "freebsd" -> `FreeBSD
| "windows" | "mingw64" | "cygwin" -> `Windows
| "macosx" -> `MacOSX
| v -> invalid_arg "Invalid argument of system option: %s" v
in
(system, output)
| _ ->
invalid_arg "Expected `%s --system <system> -o <output>' got `%s'"
Sys.argv.(0) (String.concat " " (Array.to_list Sys.argv))
in
let oc_ml, oc_c, oc_sexp =
( open_out (output ^ ".ml")
Expand Down