2 basic procedures to print messages to the standard output
9 let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());;
11 let (get_error_count,reset_error_count,inc_error_count) =
12 let error_count = ref 0 in
13 ((fun _ -> !error_count),(fun _ -> error_count := 0),
14 (fun _ -> error_count:= !error_count + 1));;
16 let (get_corner_count,reset_corner_count,inc_corner_count) =
17 let corner_count = ref 0 in
18 ((fun _ -> !corner_count),(fun _ -> corner_count := 0),
19 (fun _ -> corner_count:= !corner_count + 1));;
21 let diagnostic_string () =
22 let d = get_error_count() in
23 if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";;
26 Format.print_string s; Format.print_newline(); Format.print_flush();;
28 let report_timed s = report (s^" "^(time_string()));;
31 let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *)
33 let ec = get_error_count() in
34 (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s);
35 Pervasives.ignore(get_error_count() < error_max or raise Fatal));;
38 ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);;