diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2022-11-08 01:19:42 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2022-11-08 01:19:42 +1300 |
commit | 4ea2c7a094e4c61caeeff4b9c16cf10b8d4b14de (patch) | |
tree | 36eaf10870828e011e56123d0002aff9ae3f99dd /src/wallgen.ml | |
parent | 525863904e8cb1ce62bbbf407262e5305d6bbc6f (diff) |
Tidying up a bit of code formatting
Diffstat (limited to 'src/wallgen.ml')
-rw-r--r-- | src/wallgen.ml | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/wallgen.ml b/src/wallgen.ml index c27f0eb..240fbc4 100644 --- a/src/wallgen.ml +++ b/src/wallgen.ml @@ -18,25 +18,31 @@ let anon_fun item = let input_immediate items = - if Array.length !input_seq > 0 - then (prerr_endline "Error: Multiple input sequences specified"; exit 2) - else try input_seq := Util.read_integer_list items + if Array.length !input_seq > 0 then + (prerr_endline "Error: Multiple input sequences specified"; + exit 2) + else + try input_seq := Util.read_integer_list items with Util.Not_an_integer s -> prerr_endline ("Error: The argument '" ^ s ^ "' is not an integer"); exit 2 let input_from_file filename = - if Array.length !input_seq > 0 - then (prerr_endline "Error: Multiple input sequences specified"; exit 2) - else try input_seq := Util.read_sequence_file filename + if Array.length !input_seq > 0 then + (prerr_endline "Error: Multiple input sequences specified"; + exit 2) + else + try input_seq := Util.read_sequence_file filename with Util.Not_an_integer s -> prerr_endline ("Error: The item '" ^ s ^ "' from file '" ^ filename ^ "' is not an integer"); exit 2 let use_random len = - if Array.length !input_seq > 0 - then (prerr_endline "Error: Multiple input sequences specified"; exit 2) - else input_seq := Sequence.random ~len + if Array.length !input_seq > 0 then + (prerr_endline "Error: Multiple input sequences specified"; + exit 2) + else + input_seq := Sequence.random ~len @@ -65,14 +71,22 @@ module My_Wall = Wall.Make (My_Algebra) let _ = - if Array.length Sys.argv <= 1 then (Arg.usage speclist usage_msg; exit 1); + if Array.length Sys.argv <= 1 then + (Arg.usage speclist usage_msg; + exit 1); + Arg.parse speclist anon_fun usage_msg; - if Array.length !input_seq = 0 then (prerr_endline "Error: No input sequence provided"; exit 2); - let result = My_Wall.create - ~dimx:(Array.length !input_seq) - ~dimy:!depth_limit - ~init:!input_seq in + if Array.length !input_seq = 0 then + (prerr_endline "Error: No input sequence provided"; + exit 2); + + let result = + My_Wall.create + ~dimx:(Array.length !input_seq) + ~dimy:!depth_limit + ~init:!input_seq in + My_Wall.print result |