diff --git a/compiler/heptagon/analysis/interface.ml b/compiler/heptagon/analysis/interface.ml index e9367a2..25d810f 100644 --- a/compiler/heptagon/analysis/interface.ml +++ b/compiler/heptagon/analysis/interface.ml @@ -109,8 +109,9 @@ struct fprintf ff "@.@]" let print oc = - let ff = formatter_of_out_channel oc in + let ff = Format.formatter_of_out_channel oc in NamesEnv.iter (fun key typdesc -> deftype ff key typdesc) current.types; NamesEnv.iter (fun key constdec -> constdef ff key constdec) current.consts; NamesEnv.iter (fun key sigtype -> signature ff key sigtype) current.values; + Format.fprintf ff "@?" end diff --git a/compiler/heptagon/hept_printer.ml b/compiler/heptagon/hept_printer.ml index b263558..27fbe31 100644 --- a/compiler/heptagon/hept_printer.ml +++ b/compiler/heptagon/hept_printer.ml @@ -339,7 +339,7 @@ let print_open_module ff name = fprintf ff "@.@]" let print oc { p_opened = po; p_types = pt; p_nodes = pn; p_consts = pc } = - let ff = formatter_of_out_channel oc in + let ff = Format.formatter_of_out_channel oc in List.iter (print_open_module ff) po; List.iter (print_const_dec ff) pc; List.iter (print_type_def ff) pt; diff --git a/compiler/minils/main/mls2seq.ml b/compiler/minils/main/mls2seq.ml index 00c9975..f8a1156 100644 --- a/compiler/minils/main/mls2seq.ml +++ b/compiler/minils/main/mls2seq.ml @@ -69,7 +69,7 @@ let generate_target p s = if !Misc.verbose then begin Format.eprintf "** Translation to Obc done **\n@."; - List.iter (wrap_print Obc_printer.print_prog stderr) o_list; + List.iter (Obc_printer.print_prog Format.err_formatter) o_list; end; List.iter convert_fun o_list diff --git a/compiler/minils/mls_printer.ml b/compiler/minils/mls_printer.ml index 4b8a1d3..2247932 100644 --- a/compiler/minils/mls_printer.ml +++ b/compiler/minils/mls_printer.ml @@ -200,10 +200,9 @@ let print_node ff { n_name = n; n_input = ni; n_output = no; let print oc { p_opened = pm; p_types = pt; p_nodes = pn; p_consts = pc } = - let ff = formatter_of_out_channel oc - in ( - List.iter (print_open_module ff) pm; - List.iter (print_const_dec ff) pc; - List.iter (print_type_dec ff) pt; - List.iter (print_node ff) pn; - fprintf ff "@?" ) + let ff = formatter_of_out_channel oc in ( + List.iter (print_open_module ff) pm; + List.iter (print_const_dec ff) pc; + List.iter (print_type_dec ff) pt; + List.iter (print_node ff) pn; + fprintf ff "@?" ) diff --git a/compiler/utilities/global/compiler_utils.ml b/compiler/utilities/global/compiler_utils.ml index 3d31fe5..296bb91 100644 --- a/compiler/utilities/global/compiler_utils.ml +++ b/compiler/utilities/global/compiler_utils.ml @@ -11,18 +11,18 @@ open Location open Minils let lexical_error err loc = - Format.eprintf "%aIllegal character.\n" print_location loc; + Format.eprintf "%aIllegal character.\n@." print_location loc; raise Error let syntax_error loc = - Format.eprintf "%aSyntax error.\n" print_location loc; + Format.eprintf "%aSyntax error.\n@." print_location loc; raise Error let language_error lang = - Format.eprintf "Unknown language: '%s'.\n" lang + Format.eprintf "Unknown language: '%s'.\n@." lang let comment s = - if !verbose then Format.printf "** %s done **\n" s; flush stdout + if !verbose then Format.printf "** %s done **\n@." s let do_pass f d p pp enabled = diff --git a/compiler/utilities/misc.ml b/compiler/utilities/misc.ml index dd29055..f1ede88 100644 --- a/compiler/utilities/misc.ml +++ b/compiler/utilities/misc.ml @@ -258,7 +258,3 @@ let mapi3 f l1 l2 l3 = (f i v1 v2 v3)::(aux (i+1) l1 l2 l3) in aux 0 l1 l2 l3 - -let wrap_print pp out x = - let fmt = Format.formatter_of_out_channel out in - Format.fprintf fmt "%a@." pp x diff --git a/compiler/utilities/misc.mli b/compiler/utilities/misc.mli index a1b43f5..496c404 100644 --- a/compiler/utilities/misc.mli +++ b/compiler/utilities/misc.mli @@ -187,7 +187,3 @@ val mapi: (int -> 'a -> 'b) -> 'a list -> 'b list val mapi2: (int -> 'a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val mapi3: (int -> 'a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list - -(** Enable the use of a plain pretty-printing function with an output channel - instead of a formatter. *) -val wrap_print : (Format.formatter -> 'a -> unit) -> out_channel -> 'a -> unit