X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_kernel%2FnCicLibrary.ml;h=946535fe1fd8d5cb70775fcb38bc2dc5d7730a81;hb=246f3c2f2d26655129efacf830ecff47094795b4;hp=f25a0c54c14c731cc08a25104c07e569d7facc42;hpb=cf2b1084c561a6842d7cbc5691943ef53b151aca;p=helm.git diff --git a/helm/software/components/ng_kernel/nCicLibrary.ml b/helm/software/components/ng_kernel/nCicLibrary.ml index f25a0c54c..946535fe1 100644 --- a/helm/software/components/ng_kernel/nCicLibrary.ml +++ b/helm/software/components/ng_kernel/nCicLibrary.ml @@ -9,6 +9,8 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) +(* $Id$ *) + exception ObjectNotFound of string Lazy.t let cache = NUri.UriHash.create 313;; @@ -17,11 +19,17 @@ let get_obj u = try NUri.UriHash.find cache u with Not_found -> (* in the final implementation should get it from disk *) - let ouri = NUri.ouri_of_nuri u in - let o,_ = CicEnvironment.get_obj CicUniv.oblivion_ugraph ouri in - let l = OCic2NCic.convert_obj ouri o in - List.iter (fun (u,_,_,_,_ as o) -> -(* prerr_endline ("+"^NUri.string_of_uri u); *) - NUri.UriHash.add cache u o) l; - HExtlib.list_last l + let ouri = NCic2OCic.ouri_of_nuri u in + try + let o,_ = CicEnvironment.get_obj CicUniv.oblivion_ugraph ouri in + let l = OCic2NCic.convert_obj ouri o in + List.iter (fun (u,_,_,_,_ as o) -> + (* prerr_endline ("+"^NUri.string_of_uri u); *) + NUri.UriHash.add cache u o) l; + HExtlib.list_last l + with CicEnvironment.Object_not_found u -> + raise (ObjectNotFound + (lazy (NUri.string_of_uri (OCic2NCic.nuri_of_ouri u)))) ;; + +let clear_cache () = NUri.UriHash.clear cache;;