From 7d5414b9fe326704296440969fecadf3302c5926 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Tue, 3 Dec 2024 18:44:21 +0100 Subject: [PATCH] Upgrade ocamlformat to 0.27.0 --- .ocamlformat | 2 +- bopkit-tests.opam | 2 +- dune-project | 2 +- lib/bit_utils/src/bit_counter.ml | 12 ++-- lib/bit_utils/test/test__bit_array.ml | 2 +- lib/bit_utils/test/test__bit_matrix.ml | 18 +++-- .../test/test__bit_string_encoding.ml | 3 +- lib/bit_utils/test/test__partial_bit_array.ml | 4 +- .../test/test__partial_bit_matrix.ml | 15 ++-- lib/bopkit/src/comment.ml | 4 +- lib/bopkit/src/string_with_vars.ml | 14 ++-- lib/bopkit/test/test__comment.ml | 27 ++++--- lib/bopkit/test/test__interval.ml | 9 ++- lib/bopkit/test/test__string_with_vars.ml | 42 +++++++---- lib/bopkit_block/src/bopkit_block.ml | 26 +++---- lib/bopkit_circuit/src/cds.ml | 4 +- lib/bopkit_circuit/src/circuit.ml | 8 +-- lib/bopkit_circuit/src/gate_kind.mli | 4 +- .../src/pass_expanded_block.ml | 35 ++++----- .../src/pass_expanded_netlist.ml | 70 +++++++++--------- .../src/pass_expanded_nodes.ml | 10 +-- lib/bopkit_compiler/src/pass_memories.ml | 20 +++--- lib/bopkit_pp/src/expanded_netlist.ml | 16 ++--- lib/bopkit_pp/src/netlist.ml | 71 ++++++++++--------- .../src/bopkit_process_interpreter.ml | 8 +-- .../src/interpreted_code.ml | 6 +- lib/bopkit_process_pp/src/program.ml | 2 +- lib/bopkit_simulator/src/circuit_simulator.ml | 6 +- lib/bopkit_to_c/src/bopkit_to_c.ml | 7 +- .../src/bopkit_topological_sort.ml | 8 +-- project/subleq/circuit/disk_interface.ml | 4 +- project/subleq/circuit/subleq_ram.ml | 4 +- project/visa/lib/visa/src/executable.ml | 4 +- .../visa/lib/visa/test/test__machine_code.ml | 8 +-- .../lib/visa_assembler/src/visa_assembler.ml | 41 +++++------ project/visa/lib/visa_dsl/src/visa_dsl.ml | 4 +- .../visa/lib/visa_dsl/test/test__visa_dsl.ml | 9 +-- project/visa/lib/visa_simulator/src/code.ml | 2 +- project/visa/lib/visa_simulator/src/memory.ml | 4 +- .../lib/visa_simulator/src/visa_simulator.ml | 30 ++++---- stdlib/7-segment/src/seven_segment_code.ml | 4 +- .../7-segment/test/test__digital_calendar.ml | 8 +-- stdlib/7-segment/test/test__digital_watch.ml | 8 +-- stdlib/bopboard/src/bopboard.ml | 8 +-- stdlib/memories/bin/ram_memory.ml | 4 +- 45 files changed, 326 insertions(+), 273 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index 80df8eea..04d5660b 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,2 +1,2 @@ -version=0.26.2 +version=0.27.0 profile=janestreet diff --git a/bopkit-tests.opam b/bopkit-tests.opam index a302edd1..bc49c322 100644 --- a/bopkit-tests.opam +++ b/bopkit-tests.opam @@ -10,7 +10,7 @@ bug-reports: "https://github.com/mbarbin/bopkit/issues" depends: [ "dune" {>= "3.16"} "ocaml" {>= "5.2"} - "ocamlformat" {with-dev-setup & = "0.26.2"} + "ocamlformat" {with-dev-setup & = "0.27.0"} "ANSITerminal" {>= "0.8.3"} "appendable-list" {>= "v0.17" & < "v0.18"} "auto-format" {>= "0.0.14"} diff --git a/dune-project b/dune-project index af752e95..ec4b0c2e 100644 --- a/dune-project +++ b/dune-project @@ -349,7 +349,7 @@ (ocamlformat (and :with-dev-setup - (= 0.26.2))) + (= 0.27.0))) (ANSITerminal (>= 0.8.3)) (appendable-list diff --git a/lib/bit_utils/src/bit_counter.ml b/lib/bit_utils/src/bit_counter.ml index 82bfce90..2b4fdfdd 100644 --- a/lib/bit_utils/src/bit_counter.ml +++ b/lib/bit_utils/src/bit_counter.ml @@ -16,12 +16,12 @@ let blit_next_value t ~dst ~dst_pos = raise_s [%sexp "Bit_counter.blit_next_value" - , "dst length is too short" - , { bit_counter_length = (t.length : int) - ; dst_pos : int - ; dst_length = (len : int) - ; required_length = (dst_pos + t.length : int) - }]; + , "dst length is too short" + , { bit_counter_length = (t.length : int) + ; dst_pos : int + ; dst_length = (len : int) + ; required_length = (dst_pos + t.length : int) + }]; let next_value = t.next_value in let tmp = Array.create ~len:t.length false in Bit_array.blit_int ~dst:tmp ~src:next_value; diff --git a/lib/bit_utils/test/test__bit_array.ml b/lib/bit_utils/test/test__bit_array.ml index 2cc6c09c..500d43bc 100644 --- a/lib/bit_utils/test/test__bit_array.ml +++ b/lib/bit_utils/test/test__bit_array.ml @@ -97,7 +97,7 @@ let%expect_test "to_signed_int / to_int" = raise_s [%sexp "Unexpected signed int" - , { t : Bit_array.t; int : int; expected_signed_int : int; signed_int : int }]) + , { t : Bit_array.t; int : int; expected_signed_int : int; signed_int : int }]) ;; let%expect_test "sequence" = diff --git a/lib/bit_utils/test/test__bit_matrix.ml b/lib/bit_utils/test/test__bit_matrix.ml index 94d44b22..869b4ad8 100644 --- a/lib/bit_utils/test/test__bit_matrix.ml +++ b/lib/bit_utils/test/test__bit_matrix.ml @@ -8,7 +8,8 @@ let%expect_test "init" = [%expect {| (() () ()) |}]; let t = Bit_matrix.init_matrix_linear ~dimx:3 ~dimy:5 ~f:(fun i -> i mod 2 = 1) in Bit_matrix.to_text_channel t stdout; - [%expect {| + [%expect + {| 01010 10101 01010 |}] @@ -19,18 +20,21 @@ let%expect_test "of_bit_array" = let test t = Bit_matrix.to_text_channel t stdout in (* Shorter than input *) test (Bit_matrix.of_bit_array ~dimx:2 ~dimy:6 bit_array); - [%expect {| + [%expect + {| 010101 010101 |}]; (* Equal size of input *) test (Bit_matrix.of_bit_array ~dimx:3 ~dimy:8 bit_array); - [%expect {| + [%expect + {| 01010101 01010101 01010101 |}]; (* Longer than input *) test (Bit_matrix.of_bit_array ~dimx:4 ~dimy:9 bit_array); - [%expect {| + [%expect + {| 010101010 101010101 010101000 @@ -48,7 +52,8 @@ let%expect_test "of_text_file" = Bit_matrix.to_text_channel t stdout in test ~dimx:2 ~dimy:12; - [%expect {| + [%expect + {| 010101010101 011111111110 |}]; test ~dimx:3 ~dimy:24; @@ -58,7 +63,8 @@ let%expect_test "of_text_file" = 000000000000000000000000 000000000000000000000000 |}]; test ~dimx:4 ~dimy:4; - [%expect {| + [%expect + {| 0101 0101 0101 diff --git a/lib/bit_utils/test/test__bit_string_encoding.ml b/lib/bit_utils/test/test__bit_string_encoding.ml index 799351ba..fb2c84ef 100644 --- a/lib/bit_utils/test/test__bit_string_encoding.ml +++ b/lib/bit_utils/test/test__bit_string_encoding.ml @@ -12,7 +12,8 @@ let%expect_test "T encoding" = let t2 = Bit_string_encoding.Bit.of_char char in assert (T.equal t t2); print_s [%sexp { t : T.t; char : Char.t }]); - [%expect {| + [%expect + {| ((t false) (char 0)) ((t true) (char 1)) |}] ;; diff --git a/lib/bit_utils/test/test__partial_bit_array.ml b/lib/bit_utils/test/test__partial_bit_array.ml index 6d0fa029..1ff83823 100644 --- a/lib/bit_utils/test/test__partial_bit_array.ml +++ b/lib/bit_utils/test/test__partial_bit_array.ml @@ -39,7 +39,7 @@ let%expect_test "to_string roundtrip" = raise_s [%sexp "Value does not roundtrip" - , { t1 : Partial_bit_array.t; t2 : Partial_bit_array.t }]) + , { t1 : Partial_bit_array.t; t2 : Partial_bit_array.t }]) ;; let%expect_test "text files" = @@ -53,7 +53,7 @@ let%expect_test "text files" = raise_s [%sexp "Value does not roundtrip" - , { t : Partial_bit_array.t; t2 : Partial_bit_array.t }]; + , { t : Partial_bit_array.t; t2 : Partial_bit_array.t }]; let contents2 = Partial_bit_array.to_string t ^ "\n" in if not (String.equal contents contents2) then diff --git a/lib/bit_utils/test/test__partial_bit_matrix.ml b/lib/bit_utils/test/test__partial_bit_matrix.ml index cfe3df96..f224ffb2 100644 --- a/lib/bit_utils/test/test__partial_bit_matrix.ml +++ b/lib/bit_utils/test/test__partial_bit_matrix.ml @@ -5,18 +5,21 @@ let%expect_test "of_partial_bit_array" = let test t = Partial_bit_matrix.to_text_channel t stdout in (* Shorter than input *) test (Partial_bit_matrix.of_partial_bit_array ~dimx:2 ~dimy:6 partial_bit_array); - [%expect {| + [%expect + {| 0*0101 *1010* |}]; (* Equal size of input *) test (Partial_bit_matrix.of_partial_bit_array ~dimx:3 ~dimy:8 partial_bit_array); - [%expect {| + [%expect + {| 0*0101*1 010*0101 *1010*01 |}]; (* Longer than input *) test (Partial_bit_matrix.of_partial_bit_array ~dimx:4 ~dimy:9 partial_bit_array); - [%expect {| + [%expect + {| 0*0101*10 10*0101*1 010*01*** @@ -34,7 +37,8 @@ let%expect_test "of_text_file" = Partial_bit_matrix.to_text_channel t stdout in test ~dimx:2 ~dimy:12; - [%expect {| + [%expect + {| 010*010*01*1 0**111*11110 |}]; test ~dimx:3 ~dimy:24; @@ -44,7 +48,8 @@ let%expect_test "of_text_file" = ************************ ************************ |}]; test ~dimx:4 ~dimy:4; - [%expect {| + [%expect + {| 010* 010* 01*1 diff --git a/lib/bopkit/src/comment.ml b/lib/bopkit/src/comment.ml index 717fb195..2852d123 100644 --- a/lib/bopkit/src/comment.ml +++ b/lib/bopkit/src/comment.ml @@ -70,8 +70,8 @@ let parse_exn comment = [%sexp "Internal error. A program fragment was parsed as a comment by the parser, but \ later not recognized as such. Please report upstream." - , [%here] - , { comment : string }] + , [%here] + , { comment : string }] ;; let render = function diff --git a/lib/bopkit/src/string_with_vars.ml b/lib/bopkit/src/string_with_vars.ml index 1a10be2c..de5bf4f1 100644 --- a/lib/bopkit/src/string_with_vars.ml +++ b/lib/bopkit/src/string_with_vars.ml @@ -53,13 +53,15 @@ let parse t = then () else ( match - if Char.equal t.[i] '$' - && i <= len_t - 2 - && Char.( = ) t.[Int.succ i] (Syntax.open_char Dollar) + if + Char.equal t.[i] '$' + && i <= len_t - 2 + && Char.( = ) t.[Int.succ i] (Syntax.open_char Dollar) then Some Syntax.Dollar - else if Char.equal t.[i] '%' - && i <= len_t - 2 - && Char.( = ) t.[Int.succ i] (Syntax.open_char Percent) + else if + Char.equal t.[i] '%' + && i <= len_t - 2 + && Char.( = ) t.[Int.succ i] (Syntax.open_char Percent) then Some Syntax.Percent else None with diff --git a/lib/bopkit/test/test__comment.ml b/lib/bopkit/test/test__comment.ml index 45712a28..1684d922 100644 --- a/lib/bopkit/test/test__comment.ml +++ b/lib/bopkit/test/test__comment.ml @@ -23,7 +23,8 @@ let%expect_test "categorise" = test "//Hey*/"; [%expect {| // Hey*/ |}]; test "/*/Hey*/"; - [%expect {| + [%expect + {| /* /Hey */ |}]; test @@ -37,14 +38,17 @@ But then it has another line which is not part of a comment test "/**/"; [%expect {| /* */ |}]; test "/***/"; - [%expect {| + [%expect + {| /** */ |}]; test "/* */"; - [%expect {| + [%expect + {| /* */ |}]; test "/** */"; - [%expect {| + [%expect + {| /** */ |}]; test "/* A one line with the enclosing syntax of multiple lines comment */"; @@ -53,7 +57,8 @@ But then it has another line which is not part of a comment /* A one line with the enclosing syntax of multiple lines comment */ |}]; test "/** A documentation comment that fits on 1 line. */"; - [%expect {| + [%expect + {| /** * A documentation comment that fits on 1 line. */ |}]; @@ -71,7 +76,8 @@ But then it has another line which is not part of a comment * with non aligned text * hello */ |}]; - test {| + test + {| /** * This is some documentation comment * That is already rendered. @@ -96,7 +102,8 @@ But then it has another line which is not part of a comment * This is some documentation comment * That is already rendered sligthly differently. */ |}]; - test {| + test + {| /* This is some non documentation comment * That is already rendered. */ @@ -170,7 +177,8 @@ But then it has another line which is not part of a comment * */ |}; - [%expect {| + [%expect + {| /* A multiline comment * With trailing whitespaces also */ |}]; @@ -214,7 +222,8 @@ But then it has another line which is not part of a comment * | Check out this * | for example. */ |}]; - test {| + test + {| /// Single line comments can be documentation comments too! |}; [%expect {| /// Single line comments can be documentation comments too! |}]; diff --git a/lib/bopkit/test/test__interval.ml b/lib/bopkit/test/test__interval.ml index 42f06884..d7dce7fc 100644 --- a/lib/bopkit/test/test__interval.ml +++ b/lib/bopkit/test/test__interval.ml @@ -22,20 +22,23 @@ let%expect_test "expand_list" = test [ { from = 0; to_ = 0 } ]; [%expect {| ((0)) |}]; test [ { from = 0; to_ = -4 } ]; - [%expect {| + [%expect + {| ((0) (-1) (-2) (-3) (-4)) |}]; test [ { from = -1; to_ = 2 } ]; - [%expect {| + [%expect + {| ((-1) (0) (1) (2)) |}]; test [ { from = 0; to_ = 1 }; { from = 0; to_ = 2 } ]; - [%expect {| + [%expect + {| ((0 0) (0 1) (0 2) diff --git a/lib/bopkit/test/test__string_with_vars.ml b/lib/bopkit/test/test__string_with_vars.ml index 12e0bcee..bc45a488 100644 --- a/lib/bopkit/test/test__string_with_vars.ml +++ b/lib/bopkit/test/test__string_with_vars.ml @@ -12,19 +12,23 @@ let%expect_test "eval" = print_s [%sexp (s : string Or_eval_error.t)] in test "" []; - [%expect {| + [%expect + {| (Ok ((parts ()))) (Ok "") |}]; test "Hello" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text Hello))))) (Ok Hello) |}]; test "Hello %N}" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello %N}"))))) (Ok "Hello %N}") |}]; test "Hello %(N)" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello %(N)"))))) (Ok "Hello %(N)") |}]; test "Hello %{N}" [ "Ni", Parameter.Value.Int 2 ]; @@ -57,17 +61,21 @@ let%expect_test "eval" = (Ok ((parts ((Var N))))) (Error (Free_variable (name N) (candidates ()))) |}]; test "%{}" []; - [%expect {| + [%expect + {| (Error (Syntax_error (in_ %{}))) |}]; test "%{V" []; - [%expect {| + [%expect + {| (Error (Syntax_error (in_ %{V))) |}]; test "Hello %V" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello %V"))))) (Ok "Hello %V") |}]; test "Hello }%V}" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello }%V}"))))) (Ok "Hello }%V}") |}]; test "Hello %{hey%{nest}bou}" []; @@ -105,11 +113,13 @@ let%expect_test "eval" = print_s [%sexp (s : string Or_eval_error.t)] in test "" []; - [%expect {| + [%expect + {| (Ok ((parts ()))) (Ok "") |}]; test "Hello" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text Hello))))) (Ok Hello) |}]; test "Hello $(N)" []; @@ -142,17 +152,21 @@ let%expect_test "eval" = (Ok ((parts ((Var N))))) (Error (Free_variable (name N) (candidates ()))) |}]; test "$()" []; - [%expect {| + [%expect + {| (Error (Syntax_error (in_ "$()"))) |}]; test "$(V" []; - [%expect {| + [%expect + {| (Error (Syntax_error (in_ "$(V"))) |}]; test "Hello $V" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello $V"))))) (Ok "Hello $V") |}]; test "Hello )$V)" []; - [%expect {| + [%expect + {| (Ok ((parts ((Text "Hello )$V)"))))) (Ok "Hello )$V)") |}]; test "Hello $(hey$(nest)bou)" []; diff --git a/lib/bopkit_block/src/bopkit_block.ml b/lib/bopkit_block/src/bopkit_block.ml index 97f6b0cc..f6902211 100644 --- a/lib/bopkit_block/src/bopkit_block.ml +++ b/lib/bopkit_block/src/bopkit_block.ml @@ -43,7 +43,7 @@ module Arity = struct raise_s [%sexp "input line is too short" - , { line_length : int; needs_next_input = { from : int; len : int } }] + , { line_length : int; needs_next_input = { from : int; len : int } }] ;; let rec read_input : type a. bool array -> index:int ref -> (a, bool) t -> a = @@ -188,12 +188,12 @@ module Context = struct end let run_line - (type arguments) - (Method.Expert.T t : arguments Method.t) - ~context - ~no_output - ~(arguments : arguments) - ~line + (type arguments) + (Method.Expert.T t : arguments Method.t) + ~context + ~no_output + ~(arguments : arguments) + ~line = let output = create_output t.output_arity in let%map.Or_error () = @@ -206,9 +206,9 @@ let run_line Or_error.error_s [%sexp "External block exception" - , (context : Context.t) - , { line : string } - , (e : Exn.t)] + , (context : Context.t) + , { line : string } + , (e : Exn.t)] in let buffer = Buffer.create 23 in let fff c = Buffer.add_char buffer (Bit_string_encoding.Bit.to_char c) in @@ -285,9 +285,9 @@ let main ?readme t_param = Or_error.error_s [%sexp "parsing error" - , [%here] - , { context : Context.t; input : string } - , (e : Exn.t)] + , [%here] + , { context : Context.t; input : string } + , (e : Exn.t)] in let line = protocol.bits in match protocol.method_kind with diff --git a/lib/bopkit_circuit/src/cds.ml b/lib/bopkit_circuit/src/cds.ml index 88623871..c9e59699 100644 --- a/lib/bopkit_circuit/src/cds.ml +++ b/lib/bopkit_circuit/src/cds.ml @@ -50,8 +50,8 @@ let topological_sort (cds : t) = raise_s [%sexp "Unexpected gate_kind at index 0, expected input gate" - , [%here] - , { gate_kind : Gate_kind.t }]); + , [%here] + , { gate_kind : Gate_kind.t }]); for i = Int.pred ncds downto 0 do if not visited.(i) then dfs i done; diff --git a/lib/bopkit_circuit/src/circuit.ml b/lib/bopkit_circuit/src/circuit.ml index 0a6231ec..ad0d5ad5 100644 --- a/lib/bopkit_circuit/src/circuit.ml +++ b/lib/bopkit_circuit/src/circuit.ml @@ -25,8 +25,8 @@ let verify_input_output_gate_count_exn t = raise_s [%sexp "Expected circuit to have exactly 1 input and 1 output" - , [%here] - , { inputs : int; outputs : int }] + , [%here] + , { inputs : int; outputs : int }] ;; let verify_input_position_exn t = @@ -36,8 +36,8 @@ let verify_input_position_exn t = raise_s [%sexp "Expected first gate of circuit to be its input" - , [%here] - , { gate_kind : Gate_kind.t }] + , [%here] + , { gate_kind : Gate_kind.t }] ;; let create_exn ~path ~main ~rom_memories ~external_blocks ~cds ~input_names ~output_names = diff --git a/lib/bopkit_circuit/src/gate_kind.mli b/lib/bopkit_circuit/src/gate_kind.mli index 0a8b56f4..c944f3f2 100644 --- a/lib/bopkit_circuit/src/gate_kind.mli +++ b/lib/bopkit_circuit/src/gate_kind.mli @@ -31,11 +31,11 @@ type t = ; method_name : string option ; arguments : string list ; protocol_prefix : string Core.Set_once.t - (** The method name and the arguments are constant for a given gate, + (** The method name and the arguments are constant for a given gate, thus the simulator caches the prefix of the string that it will send to the external process. *) ; index : int Core.Set_once.t - (** The index of the external gate in the process table is determined + (** The index of the external gate in the process table is determined at runtime during the initialization of the simulation. *) } [@@deriving sexp_of] diff --git a/lib/bopkit_compiler/src/pass_expanded_block.ml b/lib/bopkit_compiler/src/pass_expanded_block.ml index b394173a..265937d0 100644 --- a/lib/bopkit_compiler/src/pass_expanded_block.ml +++ b/lib/bopkit_compiler/src/pass_expanded_block.ml @@ -107,9 +107,9 @@ let detect_cycle_in_block (fd : Expanded_block.t) = ;; let create_block - (fd : Bopkit.Expanded_netlist.block) - ~(primitives : Primitive.env) - ~(env : Expanded_block.env) + (fd : Bopkit.Expanded_netlist.block) + ~(primitives : Primitive.env) + ~(env : Expanded_block.env) = let loc = fd.loc in let name, entree_list, sortie_list, unused, corps_c = @@ -168,12 +168,12 @@ let create_block (* une variable ne peut pas etre branchée a deux sortie de primitives, sauf si c'est "_" qui n'est pas utilisee par construction *) let f_fold - (set_e, set_s) - { Bopkit.Expanded_netlist.loc = _ - ; call = _ - ; inputs = { expanded = e_l; _ } - ; outputs = { expanded = s_l; _ } - } + (set_e, set_s) + { Bopkit.Expanded_netlist.loc = _ + ; call = _ + ; inputs = { expanded = e_l; _ } + ; outputs = { expanded = s_l; _ } + } = ( List.fold_left e_l ~init:set_e ~f:Set.add , List.fold_left s_l ~init:set_s ~f:(fun set s -> @@ -272,9 +272,10 @@ let create_block (* si une variable local est observee mais pas assignee *) Set.iter variables_locales ~f:variable_non_assignee; Set.iter unused_decl ~f:(fun unused_var -> - if (not (String.equal unused_var "_")) - && (not (Set.mem sorties_appel unused_var)) - && not (Set.mem ensemble_entree unused_var) + if + (not (String.equal unused_var "_")) + && (not (Set.mem sorties_appel unused_var)) + && not (Set.mem ensemble_entree unused_var) then Err.error ~loc @@ -294,11 +295,11 @@ let create_block (* C'est un triplet (type_appel, entrees_effct, sorties_effct) *) (* WARNING call name devient de type Block ou PipeCall *) let make_appel - { Bopkit.Expanded_netlist.loc - ; call - ; inputs = { expanded = ent; _ } - ; outputs = { expanded = sor; _ } - } + { Bopkit.Expanded_netlist.loc + ; call + ; inputs = { expanded = ent; _ } + ; outputs = { expanded = sor; _ } + } = match call with | External_block diff --git a/lib/bopkit_compiler/src/pass_expanded_netlist.ml b/lib/bopkit_compiler/src/pass_expanded_netlist.ml index e1dea52c..f0a48697 100644 --- a/lib/bopkit_compiler/src/pass_expanded_netlist.ml +++ b/lib/bopkit_compiler/src/pass_expanded_netlist.ml @@ -190,9 +190,9 @@ let request_expansion (t : t) ~name ~loc = ;; let request_specialisation - (t : t) - ({ Specialisation_request.loc; parameters; name; arguments; functional_arguments } as - specialisation_request) + (t : t) + ({ Specialisation_request.loc; parameters; name; arguments; functional_arguments } + as specialisation_request) = let specialisation_key = Specialisation_key.of_specialisation_request specialisation_request @@ -313,11 +313,11 @@ let add_functional_parameters ~functional_parameters ~parameters = ;; let eval_functional_argument - (t : t) - (arg : Bopkit.Netlist.functional_argument) - ~loc - ~parameters - ~functional_parameters + (t : t) + (arg : Bopkit.Netlist.functional_argument) + ~loc + ~parameters + ~functional_parameters = if arg.name_is_quoted then @@ -341,12 +341,12 @@ type expanded_call = } let expand_call - (t : t) - (call : Bopkit.Netlist.call) - ~loc - ~parameters - ~functional_parameters - ~expected_output_width + (t : t) + (call : Bopkit.Netlist.call) + ~loc + ~parameters + ~functional_parameters + ~expected_output_width : expanded_call = let ok_eval_exn res = Bopkit.Or_eval_error.ok_exn res ~loc in @@ -433,8 +433,8 @@ let expand_call let empty_variables = { Bopkit.Expanded_netlist.expanded = []; original_grouping = [] } let append_variables - { Bopkit.Expanded_netlist.expanded = a; original_grouping = b } - { Bopkit.Expanded_netlist.expanded = c; original_grouping = d } + { Bopkit.Expanded_netlist.expanded = a; original_grouping = b } + { Bopkit.Expanded_netlist.expanded = c; original_grouping = d } : Bopkit.Expanded_netlist.variables = { expanded = a @ c; original_grouping = b @ d } @@ -443,10 +443,10 @@ let append_variables let concat_variables all = List.fold_left all ~init:empty_variables ~f:append_variables let expand_node_nesting - (t : t) - (node : Bopkit.Netlist.node) - ~parameters - ~functional_parameters + (t : t) + (node : Bopkit.Netlist.node) + ~parameters + ~functional_parameters = let { Bopkit.Netlist.loc; comments = _; call; inputs; outputs } = node in let outputs = expand_variables t ~variables:outputs ~parameters in @@ -504,21 +504,21 @@ let create_state blocks ~primitives ~parameters = ;; let expand_block - (t : t) - ~parameters - ~functional_parameters - ~expanded_interface:{ Expanded_interface.name; inputs; outputs } - ~block: - { Bopkit.Netlist.loc - ; head_comments = _ - ; tail_comments = _ - ; name = _ - ; attributes - ; inputs = _ - ; outputs = _ - ; unused_variables - ; nodes - } + (t : t) + ~parameters + ~functional_parameters + ~expanded_interface:{ Expanded_interface.name; inputs; outputs } + ~block: + { Bopkit.Netlist.loc + ; head_comments = _ + ; tail_comments = _ + ; name = _ + ; attributes + ; inputs = _ + ; outputs = _ + ; unused_variables + ; nodes + } = let unused_variables = expand_variables t ~variables:unused_variables ~parameters in let nodes = diff --git a/lib/bopkit_compiler/src/pass_expanded_nodes.ml b/lib/bopkit_compiler/src/pass_expanded_nodes.ml index c213d652..6a53d2b3 100644 --- a/lib/bopkit_compiler/src/pass_expanded_nodes.ml +++ b/lib/bopkit_compiler/src/pass_expanded_nodes.ml @@ -78,7 +78,6 @@ let pass ~(env : Expanded_block.env) ~main_block_name ~config : Expanded_nodes.t fonctionnelle de la net-list. -Modifie file_node par effet de bord, -recolte les liaisons necessaires au branchement correct de tous les fils *) - (* La fonction TRAITE figurant dans le rapport latex. Cette fonction travaille par induction sur les listes d'appels des corps. Elle renvoit la table des liaisons *) @@ -104,10 +103,11 @@ let pass ~(env : Expanded_block.env) ~main_block_name ~config : Expanded_nodes.t Err.debug (lazy [ Pp.text "Inlining blocks." ]); aux_nodes main.nodes; Map.iteri env ~f:(fun ~key:name ~data:fd -> - if (not (String.equal name main_block_name)) - && (not (Hash_set.mem fonctions_utilisees name)) - && Fpath.equal (fd.loc |> Loc.path) (main.loc |> Loc.path) - && Option.is_none (Config.main config) + if + (not (String.equal name main_block_name)) + && (not (Hash_set.mem fonctions_utilisees name)) + && Fpath.equal (fd.loc |> Loc.path) (main.loc |> Loc.path) + && Option.is_none (Config.main config) then Err.warning ~loc:fd.loc [ Pp.textf "Unused block '%s'." name ]); array_of_file_node () ;; diff --git a/lib/bopkit_compiler/src/pass_memories.ml b/lib/bopkit_compiler/src/pass_memories.ml index 5200e53b..6e2b8f96 100644 --- a/lib/bopkit_compiler/src/pass_memories.ml +++ b/lib/bopkit_compiler/src/pass_memories.ml @@ -57,16 +57,16 @@ let pass memories ~parameters = primitives dans laquelle on a ajoute la primitive memoire correspondant a la declaration -> Utilisee avec un fold_left *) let add_une_memoire - arit - ({ Bopkit.Netlist.loc - ; comments = _ - ; name - ; memory_kind - ; address_width - ; data_width - ; memory_content - } : - Bopkit.Netlist.memory) + arit + ({ Bopkit.Netlist.loc + ; comments = _ + ; name + ; memory_kind + ; address_width + ; data_width + ; memory_content + } : + Bopkit.Netlist.memory) = let ok_eval_exn res = Bopkit.Or_eval_error.ok_exn res ~loc in let address_width, data_width = diff --git a/lib/bopkit_pp/src/expanded_netlist.ml b/lib/bopkit_pp/src/expanded_netlist.ml index 22a80a3c..73e54b6e 100644 --- a/lib/bopkit_pp/src/expanded_netlist.ml +++ b/lib/bopkit_pp/src/expanded_netlist.ml @@ -44,14 +44,14 @@ let map_node { Bopkit.Expanded_netlist.loc; call; inputs; outputs } = ;; let map_block - { Bopkit.Expanded_netlist.loc - ; name - ; attributes - ; inputs - ; outputs - ; unused_variables - ; nodes - } + { Bopkit.Expanded_netlist.loc + ; name + ; attributes + ; inputs + ; outputs + ; unused_variables + ; nodes + } = { Bopkit.Netlist.loc ; head_comments = Bopkit.Comments.none diff --git a/lib/bopkit_pp/src/netlist.ml b/lib/bopkit_pp/src/netlist.ml index e9d8eb3e..4bc52082 100644 --- a/lib/bopkit_pp/src/netlist.ml +++ b/lib/bopkit_pp/src/netlist.ml @@ -9,9 +9,9 @@ let string_with_vars str = raise_s [%sexp "Internal error: Invalid string with var" - , [%here] - , { str : string } - , (e : Bopkit.Eval_error.t)] + , [%here] + , { str : string } + , (e : Bopkit.Eval_error.t)] ;; let pp_comments comments = @@ -82,14 +82,14 @@ let pp_parameter { Bopkit.Netlist.loc = _; comments; name; parameter_value } = ;; let pp_memory - { Bopkit.Netlist.loc = _ - ; comments - ; name - ; memory_kind - ; address_width - ; data_width - ; memory_content - } + { Bopkit.Netlist.loc = _ + ; comments + ; name + ; memory_kind + ; address_width + ; data_width + ; memory_content + } = Pp.concat [ pp_comments comments @@ -222,7 +222,14 @@ let pp_external_api ~first_in_group a = ;; let pp_external_block - { Bopkit.Netlist.loc = _; head_comments; tail_comments; name; attributes; api; command } + { Bopkit.Netlist.loc = _ + ; head_comments + ; tail_comments + ; name + ; attributes + ; api + ; command + } = pp_comments head_comments ++ (Pp.concat @@ -390,8 +397,8 @@ and pp_imbrication (t : Bopkit.Netlist.nested_inputs) = ;; let pp_node - ~first_in_group - ({ loc = _; comments; call; inputs; outputs } as t : Bopkit.Netlist.node) + ~first_in_group + ({ loc = _; comments; call; inputs; outputs } as t : Bopkit.Netlist.node) = let outputs = Pp.concat_map @@ -423,16 +430,16 @@ let pp_node ;; let pp_block - { Bopkit.Netlist.loc = _ - ; head_comments - ; tail_comments - ; name - ; attributes - ; inputs - ; outputs - ; unused_variables - ; nodes - } + { Bopkit.Netlist.loc = _ + ; head_comments + ; tail_comments + ; name + ; attributes + ; inputs + ; outputs + ; unused_variables + ; nodes + } = let name = match name with @@ -510,14 +517,14 @@ let pp_block ;; let pp - ({ Bopkit.Netlist.include_files - ; parameters - ; memories - ; external_blocks - ; blocks - ; eof_comments - } : - t) + ({ Bopkit.Netlist.include_files + ; parameters + ; memories + ; external_blocks + ; blocks + ; eof_comments + } : + t) = let include_files = match include_files with diff --git a/lib/bopkit_process_interpreter/src/bopkit_process_interpreter.ml b/lib/bopkit_process_interpreter/src/bopkit_process_interpreter.ml index 58b9db9b..2f00b477 100644 --- a/lib/bopkit_process_interpreter/src/bopkit_process_interpreter.ml +++ b/lib/bopkit_process_interpreter/src/bopkit_process_interpreter.ml @@ -1,8 +1,8 @@ let execute_instruction - ~(break : unit Or_error.t With_return.return) - ~architecture - ~memory - ~instruction + ~(break : unit Or_error.t With_return.return) + ~architecture + ~memory + ~instruction = match (instruction : Interpreted_code.Instruction.t) with | Input { addresses } -> diff --git a/lib/bopkit_process_interpreter/src/interpreted_code.ml b/lib/bopkit_process_interpreter/src/interpreted_code.ml index f649cb46..641e01d7 100644 --- a/lib/bopkit_process_interpreter/src/interpreted_code.ml +++ b/lib/bopkit_process_interpreter/src/interpreted_code.ml @@ -36,9 +36,9 @@ let unknown_operator_error ~(operator_name : Bopkit_process.Operator_name.t Loc. ;; let operator_arity_error - ~(operator_name : Bopkit_process.Operator_name.t Loc.Txt.t) - ~arity - ~number_of_arguments + ~(operator_name : Bopkit_process.Operator_name.t Loc.Txt.t) + ~arity + ~number_of_arguments = Err.error ~loc:operator_name.loc diff --git a/lib/bopkit_process_pp/src/program.ml b/lib/bopkit_process_pp/src/program.ml index 41c3c32f..75bd737f 100644 --- a/lib/bopkit_process_pp/src/program.ml +++ b/lib/bopkit_process_pp/src/program.ml @@ -23,7 +23,7 @@ let pp_comments comments = ;; let pp_assignment - { Bopkit_process.Program.Assignment.comments; result; operator_name; arguments } + { Bopkit_process.Program.Assignment.comments; result; operator_name; arguments } = let open Pp.O in let operator = pp_operator_name operator_name in diff --git a/lib/bopkit_simulator/src/circuit_simulator.ml b/lib/bopkit_simulator/src/circuit_simulator.ml index 081326ab..6c53b50e 100644 --- a/lib/bopkit_simulator/src/circuit_simulator.ml +++ b/lib/bopkit_simulator/src/circuit_simulator.ml @@ -47,7 +47,7 @@ module External_process = struct ; output_pipe : In_channel.t ; input_pipe : Out_channel.t ; mutable pending_input : Pending_input.t option - (* [pending_input] is used to improve error messages in the case of a + (* [pending_input] is used to improve error messages in the case of a process terminating before responding to an input. *) } end @@ -77,7 +77,7 @@ let of_circuit ~(circuit : Bopkit_circuit.Circuit.t) = raise_s [%sexp "Expected first gate of circuit to be its input" - , { gate_kind : Bopkit_circuit.Gate_kind.t }] + , { gate_kind : Bopkit_circuit.Gate_kind.t }] in let output = match @@ -294,7 +294,7 @@ let quit t = raise_s [%sexp "Uncaught exceptions during external process termination" - , (Queue.to_list uncaught_exceptions : exn list)] + , (Queue.to_list uncaught_exceptions : exn list)] ;; (* For each [Regr], update its matching [Regt]. Called at the end of each cycle. *) diff --git a/lib/bopkit_to_c/src/bopkit_to_c.ml b/lib/bopkit_to_c/src/bopkit_to_c.ml index 2d1884bc..bc8c45bf 100644 --- a/lib/bopkit_to_c/src/bopkit_to_c.ml +++ b/lib/bopkit_to_c/src/bopkit_to_c.ml @@ -57,8 +57,8 @@ let fragments_of_cds ~(cds : Bopkit_circuit.Cds.t) = raise_s [%sexp "Internal error, duplicated output_wires" - , [%here] - , { output_wire : Bopkit_circuit.Output_wire.t }] + , [%here] + , { output_wire : Bopkit_circuit.Output_wire.t }] else Hashtbl.set output_variables ~key:output_wire ~data:s); s) in @@ -129,8 +129,7 @@ let emit_c_code ~(circuit : Bopkit_circuit.Circuit.t) ~to_:oc = let main = circuit.main in let cds = circuit.cds in let roms = circuit.rom_memories in - let (Fragments.T - { variables; declarations; assignments; nodes; rams; update_registers }) + let (Fragments.T { variables; declarations; assignments; nodes; rams; update_registers }) = fragments_of_cds ~cds in diff --git a/lib/bopkit_topological_sort/src/bopkit_topological_sort.ml b/lib/bopkit_topological_sort/src/bopkit_topological_sort.ml index fb48039c..f7bc3f18 100644 --- a/lib/bopkit_topological_sort/src/bopkit_topological_sort.ml +++ b/lib/bopkit_topological_sort/src/bopkit_topological_sort.ml @@ -21,10 +21,10 @@ module Node_and_key = struct end let sort - (type node key) - (module Node : Node with type t = node and type key = key) - (module Key : Key with type t = key) - (nodes : node list) + (type node key) + (module Node : Node with type t = node and type key = key) + (module Key : Key with type t = key) + (nodes : node list) = let nodes_table = Hashtbl.create (module Key) in let nodes = diff --git a/project/subleq/circuit/disk_interface.ml b/project/subleq/circuit/disk_interface.ml index 5f2c4fe8..76e7c480 100644 --- a/project/subleq/circuit/disk_interface.ml +++ b/project/subleq/circuit/disk_interface.ml @@ -26,8 +26,8 @@ let init ~architecture ~debug ~files_prefix ~number_of_programs = Core_thread.create ~on_uncaught_exn:`Kill_whole_process (fun () -> - Bopkit_memory.event_loop mem ~read_only:true; - Stdlib.exit 0) + Bopkit_memory.event_loop mem ~read_only:true; + Stdlib.exit 0) () in Bopkit_memory.draw mem); diff --git a/project/subleq/circuit/subleq_ram.ml b/project/subleq/circuit/subleq_ram.ml index ac969fb0..08e35450 100644 --- a/project/subleq/circuit/subleq_ram.ml +++ b/project/subleq/circuit/subleq_ram.ml @@ -22,8 +22,8 @@ let init ~architecture ~cl ~debug = Core_thread.create ~on_uncaught_exn:`Kill_whole_process (fun () -> - Bopkit_memory.event_loop mem ~read_only:true; - Stdlib.exit 0) + Bopkit_memory.event_loop mem ~read_only:true; + Stdlib.exit 0) () in Bopkit_memory.draw mem); diff --git a/project/visa/lib/visa/src/executable.ml b/project/visa/lib/visa/src/executable.ml index e60615da..036632d7 100644 --- a/project/visa/lib/visa/src/executable.ml +++ b/project/visa/lib/visa/src/executable.ml @@ -70,8 +70,8 @@ let resolve_labels (t : With_labels.t) = raise_s [%sexp "Undefined label" - , [%here] - , { i : int; instruction : Label.t Instruction.t; label : Label.t }])) + , [%here] + , { i : int; instruction : Label.t Instruction.t; label : Label.t }])) ;; let to_machine_code (t : t) = Machine_code.of_instructions t diff --git a/project/visa/lib/visa/test/test__machine_code.ml b/project/visa/lib/visa/test/test__machine_code.ml index 46fecdd3..1906169e 100644 --- a/project/visa/lib/visa/test/test__machine_code.ml +++ b/project/visa/lib/visa/test/test__machine_code.ml @@ -8,10 +8,10 @@ let%expect_test "operation" = raise_s [%sexp "Visa.Machine_code does not round-trip" - , { byte : Visa.Machine_code.Byte.t - ; operation : Operation.t - ; operation' : Operation.t - }]; + , { byte : Visa.Machine_code.Byte.t + ; operation : Operation.t + ; operation' : Operation.t + }]; print_endline (sprintf "%20s : %s - opcode=%02d" diff --git a/project/visa/lib/visa_assembler/src/visa_assembler.ml b/project/visa/lib/visa_assembler/src/visa_assembler.ml index 7a957219..c052dd1a 100644 --- a/project/visa/lib/visa_assembler/src/visa_assembler.ml +++ b/project/visa/lib/visa_assembler/src/visa_assembler.ml @@ -101,10 +101,10 @@ let check_unused_macro_parameters ~(environment : Environment.t) = Map.iter environment.macros ~f:(fun { macro_name; parameters; body } -> let used_parameters = Hash_set.create (module Visa.Parameter_name) in List.iter body ~f:(function { loc = _; operation_kind = _; arguments } -> - List.iter arguments ~f:(fun argument -> - match argument.txt with - | Parameter { parameter_name } -> Hash_set.add used_parameters parameter_name - | _ -> ())); + List.iter arguments ~f:(fun argument -> + match argument.txt with + | Parameter { parameter_name } -> Hash_set.add used_parameters parameter_name + | _ -> ())); let unused_parameters = List.filter parameters ~f:(fun parameter_name -> not (Hash_set.mem used_parameters parameter_name)) @@ -124,8 +124,8 @@ let check_unused_macro_parameters ~(environment : Environment.t) = ;; let check_unused_definitions - ~(environment : Environment.t) - ~(assembly_constructs : Assembly_construct.t list) + ~(environment : Environment.t) + ~(assembly_constructs : Assembly_construct.t list) = let used_constants = Hash_set.create (module Visa.Constant_name) in let used_macros = Hash_set.create (module Visa.Macro_name) in @@ -187,10 +187,10 @@ let build_instruction ~(environment : Environment.t) ~loc ~instruction_name ~arg , Error.create_s [%sexp "Invalid number of arguments" - , { instruction_name : Visa.Instruction_name.t - ; expects : int - ; is_applied_to = (List.length arguments : int) - }] ) + , { instruction_name : Visa.Instruction_name.t + ; expects : int + ; is_applied_to = (List.length arguments : int) + }] ) in let zero_argument () = match arguments with @@ -213,11 +213,11 @@ let build_instruction ~(environment : Environment.t) ~loc ~instruction_name ~arg , Error.create_s [%sexp "Invalid argument" - , { instruction_name : Visa.Instruction_name.t - ; arg : int - ; expected : Sexp.t - ; applied_to = (argument : Visa.Assembly_instruction.Argument.t) - }] ) + , { instruction_name : Visa.Instruction_name.t + ; arg : int + ; expected : Sexp.t + ; applied_to = (argument : Visa.Assembly_instruction.Argument.t) + }] ) in let register_name ~arg (argument : Visa.Assembly_instruction.Argument.t Loc.Txt.t) = match argument.txt with @@ -306,9 +306,9 @@ let build_instruction ~(environment : Environment.t) ~loc ~instruction_name ~arg ;; let rec lookup_argument - ~(environment : Environment.t) - ~bindings - ~(argument : Visa.Assembly_instruction.Argument.t Loc.Txt.t) + ~(environment : Environment.t) + ~bindings + ~(argument : Visa.Assembly_instruction.Argument.t Loc.Txt.t) = let open Result.Let_syntax in match argument.txt with @@ -353,8 +353,9 @@ let program_to_executable_with_labels ~(program : Visa.Program.t) = Queue.enqueue executable { label_introduction; instruction } in let rec process_assembly_instruction - ~bindings - ~assembly_instruction:{ Visa.Assembly_instruction.loc; operation_kind; arguments } + ~bindings + ~assembly_instruction: + { Visa.Assembly_instruction.loc; operation_kind; arguments } = match List.map arguments ~f:(fun argument -> diff --git a/project/visa/lib/visa_dsl/src/visa_dsl.ml b/project/visa/lib/visa_dsl/src/visa_dsl.ml index 8319d667..4305d3d9 100644 --- a/project/visa/lib/visa_dsl/src/visa_dsl.ml +++ b/project/visa/lib/visa_dsl/src/visa_dsl.ml @@ -130,8 +130,8 @@ module O = struct raise_s [%sexp "Invalid visa construct inside macro" - , [%here] - , (construct : Visa.Program.Top_level_construct.t)] + , [%here] + , (construct : Visa.Program.Top_level_construct.t)] | Assembly_instruction { assembly_instruction = i } -> i) in Queue.enqueue diff --git a/project/visa/lib/visa_dsl/test/test__visa_dsl.ml b/project/visa/lib/visa_dsl/test/test__visa_dsl.ml index 5fd28dfd..838b099b 100644 --- a/project/visa/lib/visa_dsl/test/test__visa_dsl.ml +++ b/project/visa/lib/visa_dsl/test/test__visa_dsl.ml @@ -15,7 +15,8 @@ let loop () : Visa.Program.t = let%expect_test "loop pp" = let program = loop () in print_endline (Pp_extended.to_string (Visa_pp.Program.pp program)); - [%expect {| + [%expect + {| LOOP: load #1, R0 add @@ -156,9 +157,9 @@ let%expect_test "minus" = raise_s [%sexp "Executable differ" - , { executable_with_ocaml_macro : Visa.Executable.t - ; executable_with_visa_macro : Visa.Executable.t - }]); + , { executable_with_ocaml_macro : Visa.Executable.t + ; executable_with_visa_macro : Visa.Executable.t + }]); [%expect {||}]; () ;; diff --git a/project/visa/lib/visa_simulator/src/code.ml b/project/visa/lib/visa_simulator/src/code.ml index 0a29175c..de019682 100644 --- a/project/visa/lib/visa_simulator/src/code.ml +++ b/project/visa/lib/visa_simulator/src/code.ml @@ -13,7 +13,7 @@ type t = [@@deriving sexp_of] let of_assembly_constructs - ~(assembly_constructs : Visa_assembler.Assembly_construct.t list) + ~(assembly_constructs : Visa_assembler.Assembly_construct.t list) = let pending_labels = Queue.create () in let statements = Queue.create () in diff --git a/project/visa/lib/visa_simulator/src/memory.ml b/project/visa/lib/visa_simulator/src/memory.ml index b6042ca3..c0697255 100644 --- a/project/visa/lib/visa_simulator/src/memory.ml +++ b/project/visa/lib/visa_simulator/src/memory.ml @@ -46,8 +46,8 @@ let load_initial_memory t memory = raise_s [%sexp "Invalid memory dimension. Expected [256 x 8]." - , [%here] - , { dimx : int; dimy : int }]; + , [%here] + , { dimx : int; dimy : int }]; Ram.blit t.memory ~memory ;; diff --git a/project/visa/lib/visa_simulator/src/visa_simulator.ml b/project/visa/lib/visa_simulator/src/visa_simulator.ml index 8b80a1c1..b57229c8 100644 --- a/project/visa/lib/visa_simulator/src/visa_simulator.ml +++ b/project/visa/lib/visa_simulator/src/visa_simulator.ml @@ -117,11 +117,12 @@ let execute_instruction t ~instruction = | Some statement_index -> return statement_index | None -> Or_error.error_s [%sexp "Label not found", { label : Visa.Label.t }] in - if match jump_instruction with - | Jmp _ -> true - | Jmn _ -> Memory.register_value t.memory ~register_name:R1 <> 0 - | Jmz _ -> Memory.register_value t.memory ~register_name:R1 = 0 - | _ -> assert false + if + match jump_instruction with + | Jmp _ -> true + | Jmn _ -> Memory.register_value t.memory ~register_name:R1 <> 0 + | Jmz _ -> Memory.register_value t.memory ~register_name:R1 = 0 + | _ -> assert false then ( Stack.clear t.execution_stack.macro_frames; t.execution_stack.code_pointer <- code_pointer; @@ -198,10 +199,10 @@ let step (t : t) = Or_error.error_s [%sexp "Invalid number of macro arguments" - , { macro_name : Visa.Macro_name.t Loc.Txt.t - ; expected = (List.length parameters : int) - ; applied_to = (List.length arguments : int) - }] + , { macro_name : Visa.Macro_name.t Loc.Txt.t + ; expected = (List.length parameters : int) + ; applied_to = (List.length arguments : int) + }] in let macro_frame = { Execution_stack.Macro_frame.macro_name @@ -244,11 +245,12 @@ let run (t : t) = print_endline output; Int.incr count_output) | _ -> ()); - if (not continue) - || - match t.config.stop_after_n_outputs with - | None -> false - | Some count -> !count_output >= count + if + (not continue) + || + match t.config.stop_after_n_outputs with + | None -> false + | Some count -> !count_output >= count then return.return (Ok ()) done with diff --git a/stdlib/7-segment/src/seven_segment_code.ml b/stdlib/7-segment/src/seven_segment_code.ml index bf26a685..a19c4f90 100644 --- a/stdlib/7-segment/src/seven_segment_code.ml +++ b/stdlib/7-segment/src/seven_segment_code.ml @@ -24,13 +24,15 @@ let blit ~digit ~dst ~dst_pos = Array.blit ~src:(Lazy.force all).(digit) ~src_pos:0 ~dst ~dst_pos ~len:7 ;; -let pattern = {| +let pattern = + {| 66 0 5 11 2 4 33 |} +;; let pattern_char = function | 1 | 3 | 6 -> '-' diff --git a/stdlib/7-segment/test/test__digital_calendar.ml b/stdlib/7-segment/test/test__digital_calendar.ml index 843e9565..634fdb72 100644 --- a/stdlib/7-segment/test/test__digital_calendar.ml +++ b/stdlib/7-segment/test/test__digital_calendar.ml @@ -8,10 +8,10 @@ let%expect_test "digital-calendar-decoded" = raise_s [%sexp "Digital_calendar.Decoded does not round trip" - , { d : Digital_calendar.Decoded.t - ; d' : Digital_calendar.Decoded.t - ; dst : Bit_array.Short_sexp.t - }]; + , { d : Digital_calendar.Decoded.t + ; d' : Digital_calendar.Decoded.t + ; dst : Bit_array.Short_sexp.t + }]; print_endline (Digital_calendar.Decoded.to_string d') in Expect_test_helpers_core.require_does_raise [%here] (fun () -> diff --git a/stdlib/7-segment/test/test__digital_watch.ml b/stdlib/7-segment/test/test__digital_watch.ml index a832c254..32a58231 100644 --- a/stdlib/7-segment/test/test__digital_watch.ml +++ b/stdlib/7-segment/test/test__digital_watch.ml @@ -8,10 +8,10 @@ let%expect_test "digital-watch-decoded" = raise_s [%sexp "Digital_watch.Decoded does not round trip" - , { d : Digital_watch.Decoded.t - ; d' : Digital_watch.Decoded.t - ; dst : Bit_array.Short_sexp.t - }]; + , { d : Digital_watch.Decoded.t + ; d' : Digital_watch.Decoded.t + ; dst : Bit_array.Short_sexp.t + }]; print_endline (Digital_watch.Decoded.to_string d') in test { hour = 17; minute = 54; second = 37 }; diff --git a/stdlib/bopboard/src/bopboard.ml b/stdlib/bopboard/src/bopboard.ml index cdc091c6..afa7e2ec 100644 --- a/stdlib/bopboard/src/bopboard.ml +++ b/stdlib/bopboard/src/bopboard.ml @@ -323,8 +323,8 @@ let light_method (t : t) = raise_s [%sexp "unexpected input length" - , [%here] - , { expected_length : int; input_length : int }]; + , [%here] + , { expected_length : int; input_length : int }]; Array.iter2_exn t.board.lights input ~f:set_light | [ index ] -> let index = Int.of_string index in @@ -337,8 +337,8 @@ let light_method (t : t) = raise_s [%sexp "unexpected input length" - , [%here] - , { expected_length : int; input_length : int }]; + , [%here] + , { expected_length : int; input_length : int }]; set_light t.board.lights.(index) input.(0)); if !needs_redraw then redraw t) ;; diff --git a/stdlib/memories/bin/ram_memory.ml b/stdlib/memories/bin/ram_memory.ml index ff08114e..aed85c49 100644 --- a/stdlib/memories/bin/ram_memory.ml +++ b/stdlib/memories/bin/ram_memory.ml @@ -13,8 +13,8 @@ let init ~title ~address_width ~data_width = Core_thread.create ~on_uncaught_exn:`Kill_whole_process (fun () -> - Bopkit_memory.event_loop mem ~read_only:false; - Stdlib.exit 0) + Bopkit_memory.event_loop mem ~read_only:false; + Stdlib.exit 0) () in Bopkit_memory.draw mem;