1 (* =========================================================== *)
3 (* Author: Thomas C. Hales *)
5 (* =========================================================== *)
8 basic procedures to print messages to the standard output
13 needs "verifier/interval_m/types.ml";;
15 module Report = struct
19 let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());;
21 let (get_error_count,reset_error_count,inc_error_count) =
22 let error_count = ref 0 in
23 ((fun _ -> !error_count),(fun _ -> error_count := 0),
24 (fun _ -> error_count:= !error_count + 1));;
26 let (get_corner_count,reset_corner_count,inc_corner_count) =
27 let corner_count = ref 0 in
28 ((fun _ -> !corner_count),(fun _ -> corner_count := 0),
29 (fun _ -> corner_count:= !corner_count + 1));;
31 let diagnostic_string () =
32 let d = get_error_count() in
33 if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";;
36 Format.print_string s; Format.print_newline(); Format.print_flush();;
38 let report_timed s = report (s^" "^(time_string()));;
41 let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *)
43 let ec = get_error_count() in
44 (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s);
45 Pervasives.ignore(get_error_count() < error_max or raise Fatal));;
48 ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);;