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

use named arguments in all sub-commands thanks to cmdliner monadic syntax #461

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.26.2
version=0.27.0
assignment-operator=end-line
break-cases=fit
break-fun-decl=wrap
Expand Down
2 changes: 1 addition & 1 deletion bench/report/pie_results.ml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ let make runs output_dir reference_name =
, Format.sprintf "Nothing (%d)" count_nothing )
]
|> List.filter_map (fun ((count, _, _, _) as v) ->
if count = 0 then None else Some v )
if count = 0 then None else Some v )
|> List.sort (fun (c1, _, _, _) (c2, _, _, _) -> compare c2 c1)
|> List.map mk_value |> Cmd.of_list
in
Expand Down
14 changes: 7 additions & 7 deletions bench/report/runs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ let mean_stime runs = sum_stime runs /. (count_all runs |> float_of_int)

let to_distribution ~max_time runs =
List.init max_time (fun i ->
List.fold_left
(fun count r ->
let clock = Run.clock r |> int_of_float in
if clock = i then count +. 1. else count )
0. runs )
List.fold_left
(fun count r ->
let clock = Run.clock r |> int_of_float in
if clock = i then count +. 1. else count )
0. runs )

let pp_quick_results fmt results =
let nothing = ref 0 in
Expand Down Expand Up @@ -118,8 +118,8 @@ let pp_table_results fmt results =
Format.fprintf fmt
"| Nothing | Reached | Timeout | Other | Killed | Total |@\n\
|:-------:|:-------:|:-------:|:-----:|:------:|:-----:|@\n\
| %6i | %6i | %6i | %6i | %6i | %6i |" nothing reached timeout other killed
total
| %6i | %6i | %6i | %6i | %6i | %6i |"
nothing reached timeout other killed total

let pp_table_statistics fmt results =
let total = sum_clock results in
Expand Down
11 changes: 6 additions & 5 deletions bench/report/time_distribution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ let make runs output_dir reference_name =
let output =
Gnuplot.Output.create
(`Png
Fpath.(
output_dir
// v
(Format.sprintf "results_%s_time_distribution.png" reference_name)
|> to_string ) )
Fpath.(
output_dir
// v
(Format.sprintf "results_%s_time_distribution.png"
reference_name )
|> to_string ) )
in

let range = Gnuplot.Range.X (min_time, float_of_int max_time) in
Expand Down
6 changes: 3 additions & 3 deletions example/define_host_function/life_game/runweb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ let asset_loader path =
let () =
let server = S.create ~port:8000 () in
S.add_route_handler ~meth:`GET server S.Route.return (fun _req ->
S.Response.make_string
~headers:[ ("Content-Type", "text/html") ]
(Ok (asset_loader "index.html")) );
S.Response.make_string
~headers:[ ("Content-Type", "text/html") ]
(Ok (asset_loader "index.html")) );

S.add_route_handler ~meth:`GET server
S.Route.(exact "life_browser.js" @/ return)
Expand Down
3 changes: 2 additions & 1 deletion src/annot/contract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ let pp_contract fmt { funcid; preconditions; postconditions } =
Preconditions:@;\
<1 2>@[<v>%a@]@,\
Postconditions:@;\
<1 2>@[<v>%a@]@]" pp_indice funcid
<1 2>@[<v>%a@]@]"
pp_indice funcid
(list ~sep:pp_newline pp_prop)
preconditions
(list ~sep:pp_newline pp_prop)
Expand Down
14 changes: 7 additions & 7 deletions src/ast/binary_encoder.ml
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ let encode_imports buf (funcs, tables, memories, globals) =
let encode_functions buf (funcs : binary func list) =
let idx = ref 0 in
encode_vector_list buf funcs (fun buf func ->
write_block_type_idx buf func.type_f;
incr idx )
write_block_type_idx buf func.type_f;
incr idx )

(* table: section 4 *)
let encode_tables buf tables = encode_vector_list buf tables write_table
Expand Down Expand Up @@ -707,11 +707,11 @@ let encode_datacount buf datas =
(* code: section 10 *)
let encode_codes buf funcs =
encode_vector_list buf funcs (fun buf { locals; body; _ } ->
let code_buf = Buffer.create 16 in
write_locals code_buf locals;
write_expr code_buf body ~end_op_code:None;
write_u32_of_int buf (Buffer.length code_buf);
Buffer.add_buffer buf code_buf )
let code_buf = Buffer.create 16 in
write_locals code_buf locals;
write_expr code_buf body ~end_op_code:None;
write_u32_of_int buf (Buffer.length code_buf);
Buffer.add_buffer buf code_buf )

(* data: section 11 *)
let encode_datas buf datas = encode_vector_array buf datas write_data
Expand Down
4 changes: 2 additions & 2 deletions src/ast/code_generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,11 @@ let contract_generate (owi_funcs : (string * int) array) (m : modul)
List.init (Array.length tenv.param_types) (fun i -> Local_get (Raw i))
@ [ Call (Raw old_index) ]
@ List.init (Array.length tenv.result_types) (fun i ->
Local_set (tenv.result i) )
Local_set (tenv.result i) )
in
let return =
List.init (Array.length tenv.result_types) (fun i ->
Local_get (tenv.result i) )
Local_get (tenv.result i) )
in

let* tenv, precond_checker =
Expand Down
Loading
Loading