let pkgcheck callback solver failed tested id =
let memo (tested,failed) res =
match res with
|Success(f_int) -> begin
List.iter (fun i -> Array.unsafe_set tested i true) (f_int ());
Diagnostic_int.Success(fun ?all () -> f_int ())
end
|Failure r -> begin
incr failed;
Diagnostic_int.Failure(r)
end
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
|Success(f_int) -> List.map solver.map#inttovar (f_int ())
|Failure _ -> assert false
end else []
in Diagnostic_int.Success(f)
end
in
match callback with
|None -> ()
|Some f -> f (res,req)