Some more clean up with formatter and so on.
This commit is contained in:
parent
9eaafe9736
commit
30c786c06e
7 changed files with 14 additions and 22 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 "@?" )
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue