X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2FmatitacleanLib.ml;h=2d1cbfdef4fb1d7a39cf9649b9f10c0fcec85c99;hb=6d1af82b714e5c6a7f33534d6832598e72cb23c3;hp=a263a526fd7e05a65855b3413a8eecef3818b630;hpb=ed7711935c7377ea8785a9f3b85984785b92030e;p=helm.git diff --git a/helm/matita/matitacleanLib.ml b/helm/matita/matitacleanLib.ml index a263a526f..2d1cbfdef 100644 --- a/helm/matita/matitacleanLib.ml +++ b/helm/matita/matitacleanLib.ml @@ -23,6 +23,8 @@ * http://helm.cs.unibo.it/ *) +open Printf + let debug = false let debug_prerr = if debug then prerr_endline else ignore @@ -49,8 +51,9 @@ let one_step_depend suri = let buri = buri ^ "/" in let buri = HMysql.escape buri in let obj_tbl = MetadataTypes.obj_tbl () in - Printf.sprintf - "SELECT source, h_occurrence FROM %s WHERE h_occurrence LIKE '%s%%'" obj_tbl buri + sprintf + "SELECT source, h_occurrence FROM %s WHERE h_occurrence LIKE '%s%%'" + obj_tbl buri in try let rc = HMysql.exec (MatitaDb.instance ()) query in @@ -62,11 +65,10 @@ let one_step_depend suri = l := uri :: !l | _ -> ()); let l = List.sort Pervasives.compare !l in - MatitaMisc.list_uniq l + HExtlib.list_uniq l with exn -> raise exn (* no errors should be accepted *) end - let safe_buri_of_suri suri = try @@ -77,7 +79,7 @@ let safe_buri_of_suri suri = let close_uri_list uri_to_remove = (* to remove an uri you have to remove the whole script *) let buri_to_remove = - MatitaMisc.list_uniq + HExtlib.list_uniq (List.fast_sort Pervasives.compare (List.map safe_buri_of_suri uri_to_remove)) in @@ -117,8 +119,7 @@ let close_uri_list uri_to_remove = (fun acc u -> one_step_depend u @ acc) [] uri_to_remove in let depend = - MatitaMisc.list_uniq - (List.fast_sort Pervasives.compare depend) + HExtlib.list_uniq (List.fast_sort Pervasives.compare depend) in uri_to_remove, depend @@ -136,15 +137,15 @@ let clean_baseuris ?(verbose=true) buris = if debug then List.iter debug_prerr buris; let l = close [] buris in - let l = MatitaMisc.list_uniq (List.fast_sort Pervasives.compare l) in + let l = HExtlib.list_uniq (List.fast_sort Pervasives.compare l) in let l = List.map UriManager.uri_of_string l in debug_prerr "clean_baseuri will remove:"; if debug then List.iter (fun u -> debug_prerr (UriManager.string_of_uri u)) l; Hashtbl.iter (fun buri _ -> - MatitaMisc.safe_remove (MatitaMisc.obj_file_of_baseuri buri) - ) cache_of_processed_baseuri; + MatitaMisc.safe_remove (MatitaMisc.obj_file_of_baseuri buri)) + cache_of_processed_baseuri; List.iter (MatitaSync.remove ~verbose) l; cleaned_no := !cleaned_no + List.length l; if !cleaned_no > 30 then @@ -157,3 +158,4 @@ let clean_baseuris ?(verbose=true) buris = MetadataTypes.sort_tbl (); MetadataTypes.obj_tbl(); MetadataTypes.count_tbl()] end +