Revet last commit a5f89876c2 and gives the right fix.

Plus remove all the forbidden '\n', replaced with '@.' or '@\n' depending on context.
This commit is contained in:
Léonard Gérard 2010-09-01 13:31:28 +02:00 committed by Léonard Gérard
parent a5f89876c2
commit 5c09abeb18
19 changed files with 63 additions and 65 deletions

View File

@ -126,5 +126,5 @@ let print_location ff (Loc(p1,p2)) =
copy_chunk lp2 np2 ic ff; (* copy interesting begining of l2 *) copy_chunk lp2 np2 ic ff; (* copy interesting begining of l2 *)
) )
with Sys_error _ -> (); with Sys_error _ -> ();
Format.fprintf ff "@."
end; end;
fprintf ff "@."

View File

@ -68,7 +68,7 @@ let load_module modname =
let m:env = input_value ic in let m:env = input_value ic in
if m.format_version <> interface_format_version then ( if m.format_version <> interface_format_version then (
Format.eprintf "The file %s was compiled with \ Format.eprintf "The file %s was compiled with \
an older version of the compiler.\n \ an older version of the compiler.@\n \
Please recompile %s.ept first.@." filename name; Please recompile %s.ept first.@." filename name;
raise Error raise Error
); );
@ -77,7 +77,7 @@ let load_module modname =
with with
| End_of_file | Failure _ -> | End_of_file | Failure _ ->
close_in ic; close_in ic;
Format.eprintf "Corrupted compiled interface file %s.\n\ Format.eprintf "Corrupted compiled interface file %s.@\n\
Please recompile %s.ept first.@." filename name; Please recompile %s.ept first.@." filename name;
raise Error raise Error
with with

View File

@ -86,7 +86,7 @@ let message loc kind =
begin match kind with begin match kind with
| Ecausality_cycle(ac) -> | Ecausality_cycle(ac) ->
eprintf eprintf
"%aCausality error: the following constraint is not causal.\n%a@." "%aCausality error: the following constraint is not causal.@\n%a@."
print_location loc print_location loc
output_ac ac output_ac ac
end; end;

View File

@ -169,7 +169,7 @@ module Error = struct
begin match kind with begin match kind with
| Eclash(left_ty, right_ty) -> | Eclash(left_ty, right_ty) ->
Format.eprintf "%aInitialization error: this expression has type \ Format.eprintf "%aInitialization error: this expression has type \
%a, \n\ %a, @\n\
but is expected to have type %a@." but is expected to have type %a@."
print_location loc print_location loc
Printer.print_type left_ty Printer.print_type left_ty

View File

@ -102,7 +102,7 @@ struct
(match constr with (match constr with
| [] -> () | [] -> ()
| constr -> | constr ->
fprintf ff "\n with: @["; fprintf ff "@\n with: @[";
print_list_r Static.print_size_constraint "" "," "" ff constr; print_list_r Static.print_size_constraint "" "," "" ff constr;
fprintf ff "@]" fprintf ff "@]"
); );

View File

@ -55,110 +55,109 @@ let error kind = raise (TypingError(kind))
let message loc kind = let message loc kind =
begin match kind with begin match kind with
| Emissing(s) -> | Emissing(s) ->
Format.eprintf "%a@\nNo equation is given for name %s.@." Format.eprintf "%aNo equation is given for name %s.@."
print_location loc print_location loc
s; s;
| Emissingcase(s) -> | Emissingcase(s) ->
Format.eprintf "%a@\nCase %s not defined.@." Format.eprintf "%aCase %s not defined.@."
print_location loc print_location loc
s; s;
| Eundefined(s) -> | Eundefined(s) ->
Format.eprintf "%a@\nThe name %s is unbound.@." Format.eprintf "%aThe name %s is unbound.@."
print_location loc print_location loc
s; s;
| Elast_undefined(s) -> | Elast_undefined(s) ->
Format.eprintf "%a@\nThe name %s does not have a last value.@." Format.eprintf "%aThe name %s does not have a last value.@."
print_location loc print_location loc
s; s;
| Eshould_be_last(s) -> | Eshould_be_last(s) ->
Format.eprintf "%a@\nOnly the last value of %s can be accessed.@." Format.eprintf "%aOnly the last value of %s can be accessed.@."
print_location loc print_location loc
s; s;
| Etype_clash(actual_ty, expected_ty) -> | Etype_clash(actual_ty, expected_ty) ->
Format.eprintf "%a@\nType Clash: this expression has type %a, \n\ Format.eprintf "%aType Clash: this expression has type %a, @\n\
but is expected to have type %a.@." but is expected to have type %a.@."
print_location loc print_location loc
Types.print_type actual_ty Types.print_type actual_ty
Types.print_type expected_ty Types.print_type expected_ty
| Earity_clash(actual_arit, expected_arit) -> | Earity_clash(actual_arit, expected_arit) ->
Format.eprintf Format.eprintf "%aType Clash: this expression expects %d arguments,@\n\
"%a@\nType Clash: this expression expects %d arguments,\n\
but is expected to have %d.@." but is expected to have %d.@."
print_location loc print_location loc
expected_arit actual_arit expected_arit actual_arit
| Estatic_arity_clash(actual_arit, expected_arit) -> | Estatic_arity_clash(actual_arit, expected_arit) ->
Format.eprintf Format.eprintf
"%a@\nType Clash: this node expects %d static parameters,\n\ "%aType Clash: this node expects %d static parameters,@\n\
but was given %d.@." but was given %d.@."
print_location loc print_location loc
expected_arit actual_arit expected_arit actual_arit
| Ealready_defined(s) -> | Ealready_defined(s) ->
Format.eprintf "%a@\nThe name %s is already defined.@." Format.eprintf "%aThe name %s is already defined.@."
print_location loc print_location loc
s s
| Enon_exaustive -> | Enon_exaustive ->
Format.eprintf "%a@\nSome constructors are missing in this \ Format.eprintf "%aSome constructors are missing in this \
pattern/matching.@." pattern/matching.@."
print_location loc print_location loc
| Epartial_switch(s) -> | Epartial_switch(s) ->
Format.eprintf Format.eprintf
"%a@\nThe case %s is missing.@." "%aThe case %s is missing.@."
print_location loc print_location loc
s s
| Etoo_many_outputs -> | Etoo_many_outputs ->
Format.eprintf Format.eprintf
"%a@\nA function may only returns a basic value.@." "%aA function may only returns a basic value.@."
print_location loc print_location loc
| Esome_fields_are_missing -> | Esome_fields_are_missing ->
Format.eprintf Format.eprintf
"%a@\nSome fields are missing.@." "%aSome fields are missing.@."
print_location loc print_location loc
| Esubscripted_value_not_an_array ty -> | Esubscripted_value_not_an_array ty ->
Format.eprintf Format.eprintf
"%a@\nSubscript used on a non array type : %a.@." "%aSubscript used on a non array type : %a.@."
print_location loc print_location loc
Types.print_type ty Types.print_type ty
| Earray_subscript_should_be_const -> | Earray_subscript_should_be_const ->
Format.eprintf Format.eprintf
"%a@\nSubscript has to be a static value.@." "%aSubscript has to be a static value.@."
print_location loc print_location loc
| Eundefined_const ln -> | Eundefined_const ln ->
Format.eprintf Format.eprintf
"%a@\nThe const name '%s' is unbound.@." "%aThe const name '%s' is unbound.@."
print_location loc print_location loc
(fullname ln) (fullname ln)
| Econstraint_solve_failed c -> | Econstraint_solve_failed c ->
Format.eprintf Format.eprintf
"%a@\nThe following constraint cannot be satisified:\n %a.@." "%aThe following constraint cannot be satisified:@\n%a.@."
print_location loc print_location loc
print_size_constraint c print_size_constraint c
| Etype_should_be_static ty -> | Etype_should_be_static ty ->
Format.eprintf Format.eprintf
"%a@\nThis type should be static : %a.@." "%aThis type should be static : %a.@."
print_location loc print_location loc
Types.print_type ty Types.print_type ty
| Erecord_type_expected ty -> | Erecord_type_expected ty ->
Format.eprintf Format.eprintf
"%a@\nA record was expected (found %a).@." "%aA record was expected (found %a).@."
print_location loc print_location loc
Types.print_type ty Types.print_type ty
| Eno_such_field (ty, f) -> | Eno_such_field (ty, f) ->
Format.eprintf Format.eprintf
"%a@\nThe record type '%a' does not have a '%s' field.@." "%aThe record type '%a' does not have a '%s' field.@."
print_location loc print_location loc
Types.print_type ty Types.print_type ty
(shortname f) (shortname f)
| Eempty_record -> | Eempty_record ->
Format.eprintf Format.eprintf
"%a@\nThe record is empty.@." "%aThe record is empty.@."
print_location loc print_location loc
| Eempty_array -> | Eempty_array ->
Format.eprintf Format.eprintf
"%a@\nThe array is empty.@." "%aThe array is empty.@."
print_location loc print_location loc
| Efoldi_bad_args ty -> | Efoldi_bad_args ty ->
Format.eprintf Format.eprintf
"%a@\nThe function given to foldi should expect an integer \ "%aThe function given to foldi should expect an integer \
as the last but one argument (found: %a).@." as the last but one argument (found: %a).@."
print_location loc print_location loc
Types.print_type ty Types.print_type ty

View File

@ -22,23 +22,23 @@ struct
let message loc kind = let message loc kind =
begin match kind with begin match kind with
| Evar name -> | Evar name ->
eprintf "%a@\nThe value identifier %s is unbound.@." eprintf "%aThe value identifier %s is unbound.@."
print_location loc print_location loc
name name
| Econst_var name -> | Econst_var name ->
eprintf "%a@\nThe const identifier %s is unbound.@." eprintf "%aThe const identifier %s is unbound.@."
print_location loc print_location loc
name name
| Evariable_already_defined name -> | Evariable_already_defined name ->
eprintf "%a@\nThe variable %s is already defined.@." eprintf "%aThe variable %s is already defined.@."
print_location loc print_location loc
name name
| Econst_variable_already_defined name -> | Econst_variable_already_defined name ->
eprintf "%a@\nThe const variable %s is already defined.@." eprintf "%aThe const variable %s is already defined.@."
print_location loc print_location loc
name name
| Estatic_exp_expected -> | Estatic_exp_expected ->
eprintf "%a@\nA static expression was expected.@." eprintf "%aA static expression was expected.@."
print_location loc print_location loc
end; end;
raise Misc.Error raise Misc.Error

View File

@ -23,7 +23,7 @@ type error_kind = | Etypeclash of ct * ct
let error_message loc = function let error_message loc = function
| Etypeclash (actual_ct, expected_ct) -> | Etypeclash (actual_ct, expected_ct) ->
Format.eprintf "%aClock Clash: this expression has clock %a, \n\ Format.eprintf "%aClock Clash: this expression has clock %a,@\n\
but is expected to have clock %a.@." but is expected to have clock %a.@."
print_location loc print_location loc
print_clock actual_ct print_clock actual_ct
@ -116,7 +116,7 @@ let typing_eqs h eq_list = (*TODO FIXME*)
let ty_pat = typing_pat h pat in let ty_pat = typing_pat h pat in
(try expect h ty_pat e with (try expect h ty_pat e with
| Error -> (* DEBUG *) | Error -> (* DEBUG *)
Format.eprintf "Complete expression: %a\nClock pattern: %a@." Format.eprintf "Complete expression: %a@\nClock pattern: %a@."
Mls_printer.print_exp e Mls_printer.print_exp e
Mls_printer.print_clock ty_pat; Mls_printer.print_clock ty_pat;
raise Error) raise Error)

View File

@ -188,8 +188,8 @@ struct
| Eclash (left_ty, right_ty) -> | Eclash (left_ty, right_ty) ->
Format.eprintf Format.eprintf
"%aInitialization error: this expression has type \ "%aInitialization error: this expression has type \
%a, \n\ %a,@\n\
but is expected to have type %a\n" but is expected to have type %a@."
print_location loc Printer.output_typ left_ty Printer. print_location loc Printer.output_typ left_ty Printer.
output_typ right_ty); output_typ right_ty);
raise Misc.Error) raise Misc.Error)

View File

@ -46,7 +46,7 @@ let generate_target p s =
let print_unfolded p_list = let print_unfolded p_list =
if !Misc.verbose then if !Misc.verbose then
begin begin
Format.eprintf "** Unfolding done **\n@."; Format.eprintf "** Unfolding done **@.";
List.iter (Mls_printer.print stderr) p_list; List.iter (Mls_printer.print stderr) p_list;
end in end in
@ -68,7 +68,7 @@ let generate_target p s =
print_unfolded p_list; print_unfolded p_list;
if !Misc.verbose then if !Misc.verbose then
begin begin
Format.eprintf "** Translation to Obc done **\n@."; Format.eprintf "** Translation to Obc done **@.";
List.iter (Obc_printer.print_prog Format.err_formatter) o_list; List.iter (Obc_printer.print_prog Format.err_formatter) o_list;
end; end;
List.iter convert_fun o_list List.iter convert_fun o_list

View File

@ -33,7 +33,7 @@ let rec bounds_list ty =
(** @return the [var_dec] object corresponding to the name [n] (** @return the [var_dec] object corresponding to the name [n]
in a list of [var_dec]. *) in a list of [var_dec]. *)
let rec vd_find n = function let rec vd_find n = function
| [] -> Format.printf "Not found var %s\n" (name n); raise Not_found | [] -> Format.eprintf "Not found var %s@." (name n); raise Not_found
| vd::l -> | vd::l ->
if vd.v_ident = n then vd else vd_find n l if vd.v_ident = n then vd else vd_find n l

View File

@ -220,8 +220,8 @@ let load_object_file modname =
let p:program = input_value ic in let p:program = input_value ic in
if p.p_format_version <> minils_format_version then ( if p.p_format_version <> minils_format_version then (
Format.eprintf "The file %s was compiled with \ Format.eprintf "The file %s was compiled with \
an older version of the compiler.\n \ an older version of the compiler.@\n\
Please recompile %s.ept first.\n" filename name; Please recompile %s.ept first.@." filename name;
raise Error raise Error
); );
close_in ic; close_in ic;
@ -229,12 +229,12 @@ let load_object_file modname =
with with
| End_of_file | Failure _ -> | End_of_file | Failure _ ->
close_in ic; close_in ic;
Format.eprintf "Corrupted object file %s.\n\ Format.eprintf "Corrupted object file %s.@\n\
Please recompile %s.ept first.\n" filename name; Please recompile %s.ept first.@." filename name;
raise Error raise Error
with with
| Modules.Cannot_find_file(filename) -> | Modules.Cannot_find_file(filename) ->
Format.eprintf "Cannot find the object file '%s'.\n" Format.eprintf "Cannot find the object file '%s'.@."
filename; filename;
raise Error raise Error

View File

@ -287,7 +287,6 @@ let pp_cfile_desc fmt filen cfile =
Misc.print_header_info fmt "/*" "*/"; Misc.print_header_info fmt "/*" "*/";
fprintf fmt "#ifndef %s_H@\n" headern_macro; fprintf fmt "#ifndef %s_H@\n" headern_macro;
fprintf fmt "#define %s_H@\n@\n" headern_macro; fprintf fmt "#define %s_H@\n@\n" headern_macro;
(* fprintf fmt "#include \"types.h\"\n"; *)
iter (fun d -> fprintf fmt "#include \"%s.h\"@\n" d) iter (fun d -> fprintf fmt "#include \"%s.h\"@\n" d)
deps; deps;
iter (pp_cdecl fmt) cdecls; iter (pp_cdecl fmt) cdecls;
@ -307,7 +306,7 @@ let pp_cfile_desc fmt filen cfile =
(** [output_cfile dir cfile] pretty-prints the content of [cfile] to the (** [output_cfile dir cfile] pretty-prints the content of [cfile] to the
corresponding file in the [dir] directory. *) corresponding file in the [dir] directory. *)
let output_cfile dir (filen, cfile_desc) = let output_cfile dir (filen, cfile_desc) =
if !Misc.verbose then Format.printf "C-NG generating %s/%s\n" dir filen; if !Misc.verbose then Format.printf "C-NG generating %s/%s@." dir filen;
let buf = Buffer.create 20000 in let buf = Buffer.create 20000 in
let oc = open_out (Filename.concat dir filen) in let oc = open_out (Filename.concat dir filen) in
let fmt = Format.formatter_of_buffer buf in let fmt = Format.formatter_of_buffer buf in

View File

@ -32,20 +32,20 @@ struct
let message loc kind = (match kind with let message loc kind = (match kind with
| Evar name -> | Evar name ->
eprintf "%aCode generation : The variable name '%s' is unbound.\n" eprintf "%aCode generation : The variable name '%s' is unbound.@."
print_location loc name print_location loc name
| Enode name -> | Enode name ->
eprintf "%aCode generation : The node name '%s' is unbound.\n" eprintf "%aCode generation : The node name '%s' is unbound.@."
print_location loc name print_location loc name
| Eno_unnamed_output -> | Eno_unnamed_output ->
eprintf "%aCode generation : Unnamed outputs are not supported.\n" eprintf "%aCode generation : Unnamed outputs are not supported.@."
print_location loc print_location loc
| Ederef_not_pointer -> | Ederef_not_pointer ->
eprintf "%aCode generation : Trying to deference a non pointer type.\n" eprintf "%aCode generation : Trying to deference a non pointer type.@."
print_location loc print_location loc
| Estatic_exp_compute_failed -> | Estatic_exp_compute_failed ->
eprintf "%aCode generation : Computation of the value of the static \ eprintf "%aCode generation : Computation of the value of the static \
expression failed.\n" expression failed.@."
print_location loc); print_location loc);
raise Misc.Error raise Misc.Error
end end

View File

@ -31,14 +31,14 @@ and max_step = Idents.fresh "step_max"
let assert_node_res cd = let assert_node_res cd =
let stepm = find_step_method cd in let stepm = find_step_method cd in
if List.length stepm.m_inputs > 0 then if List.length stepm.m_inputs > 0 then
(Format.eprintf "Cannot generate run-time check for node %s with inputs.\n" (Format.eprintf "Cannot generate run-time check for node %s with inputs.@."
cd.cd_name; cd.cd_name;
exit 1); exit 1);
if (match stepm.m_outputs with if (match stepm.m_outputs with
| [{ v_type = Tid nbool; }] when nbool = Initial.pbool -> false | [{ v_type = Tid nbool; }] when nbool = Initial.pbool -> false
| _ -> true) then | _ -> true) then
(Format.eprintf (Format.eprintf
"Cannot generate run-time check for node %s with non-boolean output.\n" "Cannot generate run-time check for node %s with non-boolean output.@."
cd.cd_name; cd.cd_name;
exit 1); exit 1);
let mem = let mem =

View File

@ -142,7 +142,7 @@ let rec vd_mem n = function
(** Returns the var_dec object corresponding to the name n (** Returns the var_dec object corresponding to the name n
in a list of var_dec. *) in a list of var_dec. *)
let rec vd_find n = function let rec vd_find n = function
| [] -> Format.printf "Not found var %s\n" (name n); raise Not_found | [] -> Format.eprintf "Not found var %s@." (name n); raise Not_found
| vd::l -> | vd::l ->
if vd.v_ident = n then vd else vd_find n l if vd.v_ident = n then vd else vd_find n l

View File

@ -157,7 +157,7 @@ let print_type_def ff { t_name = name; t_desc = tdesc } =
match tdesc with match tdesc with
| Type_abs -> fprintf ff "@[type %s@\n@]" name | Type_abs -> fprintf ff "@[type %s@\n@]" name
| Type_alias ty -> | Type_alias ty ->
fprintf ff "@[type %s@ = %a\n@]" name print_type ty fprintf ff "@[type %s@ = %a@\n@]" name print_type ty
| Type_enum(tag_name_list) -> | Type_enum(tag_name_list) ->
fprintf ff "@[type %s = " name; fprintf ff "@[type %s = " name;
print_list_r print_name "" "|" "" ff tag_name_list; print_list_r print_name "" "|" "" ff tag_name_list;

View File

@ -11,18 +11,18 @@ open Location
open Minils open Minils
let lexical_error err loc = let lexical_error err loc =
Format.eprintf "%aIllegal character.\n@." print_location loc; Format.eprintf "%aIllegal character.@." print_location loc;
raise Error raise Error
let syntax_error loc = let syntax_error loc =
Format.eprintf "%aSyntax error.\n@." print_location loc; Format.eprintf "%aSyntax error.@." print_location loc;
raise Error raise Error
let language_error lang = let language_error lang =
Format.eprintf "Unknown language: '%s'.\n@." lang Format.eprintf "Unknown language: '%s'.@." lang
let comment s = let comment s =
if !verbose then Format.printf "** %s done **\n@." s if !verbose then Format.printf "** %s done **@." s
let do_pass f d p pp enabled = let do_pass f d p pp enabled =

View File

@ -35,10 +35,10 @@ let locate_stdlib () =
Sys.getenv "HEPTLIB" Sys.getenv "HEPTLIB"
with with
Not_found -> standard_lib in Not_found -> standard_lib in
Format.printf "Standard library in %s\n" stdlib Format.printf "Standard library in %s@." stdlib
let show_version () = let show_version () =
Format.printf "The Heptagon compiler, version %s (%s)\n" Format.printf "The Heptagon compiler, version %s (%s)@."
version date; version date;
locate_stdlib () locate_stdlib ()