1 (* I put those functions here and not in common.ml to try to avoid
2 * as much as possible dependencies in common.ml so I can more easily
3 * make ocaml script that just do a load common.ml without the need
4 * to load many other files (like dumper.ml, or ANSITerminal.ml and
5 * other recursive dependencies).
7 * Note that you can still use the functions below from an open Common.
8 * You don't need to do a 'open Common_extra'; loading the commons.cma is
9 * enough to make the connexions.
13 (* how to use it ? ex in LFS:
14 * Common.execute_and_show_progress (w.prop_iprop#length) (fun k ->
15 * w.prop_iprop#iter (fun (p, ip) ->
22 let execute_and_show_progress len f
=
24 (* kind of continuation passed to f *)
25 let continue_pourcentage () =
27 ANSITerminal.set_cursor
1 (-1);
28 ANSITerminal.printf
[] "%d / %d" !_count len
; flush stdout
;
30 let nothing () = () in
32 ANSITerminal.printf
[] "0 / %d" len
; flush stdout
;
33 if !Common._batch_mode
35 else f
continue_pourcentage
41 Common._execute_and_show_progress_func
:= execute_and_show_progress