let pkgcheck callback solver failed tested id =
let memo (tested,failed) res =
begin
match res with
|Diagnostic_int.Success(f_int) ->
List.iter (fun i -> Array.unsafe_set tested i true) (f_int ())
|Diagnostic_int.Failure _ -> incr failed
end ; res
in
let req = Diagnostic_int.Sng id in
let res =
Util.Progress.progress progressbar_univcheck;
if not(tested.(id)) then begin
memo (tested,failed) (solve solver req)
end
else begin
let f ?(all=false) () =
if all then begin
match solve solver req with
|Diagnostic_int.Success(f_int) -> f_int ()
|Diagnostic_int.Failure _ -> assert false
end else []
in Diagnostic_int.Success(f)
end
in
match callback with
|None -> ()
|Some f -> f (res,req)