X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fng_library%2FnCicLibrary.ml;h=0620a6233dcdff5279e11b31e5b3762ad873ce68;hb=13b3c950f6714032a3c027b7b6ebbd2e3065cbfe;hp=b509ce813fd8997c713426ffba6301311328573d;hpb=a484a2c1e0c022753aefae6a74fbce9fe4cf7983;p=helm.git diff --git a/matita/components/ng_library/nCicLibrary.ml b/matita/components/ng_library/nCicLibrary.ml index b509ce813..0620a6233 100644 --- a/matita/components/ng_library/nCicLibrary.ml +++ b/matita/components/ng_library/nCicLibrary.ml @@ -146,11 +146,10 @@ let init = load_db;; class virtual status = object - inherit NCicExtraction.status + inherit NCic.status val timestamp = (time0 : timestamp) method timestamp = timestamp method set_timestamp v = {< timestamp = v >} - (*CSC: bug here, we are not copying the NCicExtraction part of the status *) end let time_travel0 (sto,ali) = @@ -196,6 +195,16 @@ let dump_obj status obj = status#set_dump {status#dump with objs = obj::status#dump.objs } ;; +let remove_objects ~baseuri = + let uri = NUri.string_of_uri baseuri in + let path = String.sub uri 4 (String.length uri - 4) in + let path = Helm_registry.get "matita.basedir" ^ path in + let map name = Sys.remove (Filename.concat path name) in + if HExtlib.is_dir path && HExtlib.is_regular (path ^ ".ng") then begin + HLog.warn ("removing contents of baseuri: " ^ uri); + Array.iter map (Sys.readdir path) + end + module type SerializerType = sig type dumpable_status @@ -251,6 +260,9 @@ module Serializer(D: sig type dumpable_s = private #dumpable_status end) = let ch = open_out (ng_path_of_baseuri baseuri) in Marshal.to_channel ch (magic,(status#dump.dependencies,status#dump.objs)) []; close_out ch; +(* + remove_objects ~baseuri; (* FG: we remove the old objects before putting the new ones*) +*) List.iter (function | `Obj (uri,obj) -> @@ -357,17 +369,10 @@ let add_obj status ((u,_,_,_,_) as orig_obj) = ) il) in local_aliases := references @ !local_aliases; - let status = status#set_timestamp (!storage,!local_aliases) in - (* To test extraction *) - try - ignore (Helm_registry.get "extract_haskell"); - let status,msg = NCicExtraction.haskell_of_obj status orig_obj in - prerr_endline msg; status - with - Helm_registry.Key_not_found _ -> status + status#set_timestamp (!storage,!local_aliases) ;; -let add_constraint status u1 u2 = +let add_constraint status ~acyclic u1 u2 = if List.exists (function `Constr (u1',u2') when u1=u1' && u2=u2' -> true | _ -> false) @@ -375,7 +380,7 @@ let add_constraint status u1 u2 = then (*CSC: raise an exception here! *) (prerr_endline "CANNOT ADD A CONSTRAINT TWICE"; assert false); - NCicEnvironment.add_lt_constraint u1 u2; + NCicEnvironment.add_lt_constraint ~acyclic u1 u2; storage := (`Constr (u1,u2)) :: !storage; status#set_timestamp (!storage,!local_aliases) ;; @@ -392,4 +397,4 @@ let get_obj status u = raise (NCicEnvironment.ObjectNotFound (lazy (NUri.string_of_uri u))) ;; -NCicEnvironment.set_get_obj get_obj;; +NCicEnvironment.set_get_obj get_obj