) references @
lookup_in_library interactive_user_uri_choice input_or_locate_uri item
with
- NCicLibrary.ObjectNotFound _ ->
+ NCicEnvironment.ObjectNotFound _ ->
lookup_in_library interactive_user_uri_choice input_or_locate_uri item)
| _ -> lookup_in_library interactive_user_uri_choice input_or_locate_uri item
;;
+nUri.cmi:
nReference.cmi: nUri.cmi
nCicUtils.cmi: nCic.cmo
nCicSubstitution.cmi: nCic.cmo
oCic2NCic.cmi: nUri.cmi nReference.cmi nCic.cmo
nCic2OCic.cmi: nUri.cmi nReference.cmi nCic.cmo
-nCicLibrary.cmi: nUri.cmi nReference.cmi nCic.cmo
nCicPp.cmi: nReference.cmi nCic.cmo
nCicEnvironment.cmi: nUri.cmi nReference.cmi nCic.cmo
nCicReduction.cmi: nCic.cmo
nCicTypeChecker.cmi: nUri.cmi nReference.cmi nCic.cmo
+nCicLibrary.cmi: nUri.cmi nReference.cmi nCic.cmo
nCicUntrusted.cmi: nCic.cmo
nCic.cmo: nUri.cmi nReference.cmi
nCic.cmx: nUri.cmx nReference.cmx
oCic2NCic.cmi
nCic2OCic.cmo: nUri.cmi nReference.cmi nCic.cmo nCic2OCic.cmi
nCic2OCic.cmx: nUri.cmx nReference.cmx nCic.cmx nCic2OCic.cmi
-nCicLibrary.cmo: oCic2NCic.cmi nUri.cmi nReference.cmi nCic2OCic.cmi nCic.cmo \
- nCicLibrary.cmi
-nCicLibrary.cmx: oCic2NCic.cmx nUri.cmx nReference.cmx nCic2OCic.cmx nCic.cmx \
- nCicLibrary.cmi
nCicPp.cmo: nUri.cmi nReference.cmi nCicSubstitution.cmi nCicLibrary.cmi \
- nCic.cmo nCicPp.cmi
+ nCicEnvironment.cmi nCic.cmo nCicPp.cmi
nCicPp.cmx: nUri.cmx nReference.cmx nCicSubstitution.cmx nCicLibrary.cmx \
- nCic.cmx nCicPp.cmi
-nCicEnvironment.cmo: nUri.cmi nReference.cmi nCicLibrary.cmi nCic.cmo \
- nCicEnvironment.cmi
-nCicEnvironment.cmx: nUri.cmx nReference.cmx nCicLibrary.cmx nCic.cmx \
- nCicEnvironment.cmi
+ nCicEnvironment.cmx nCic.cmx nCicPp.cmi
+nCicEnvironment.cmo: nUri.cmi nReference.cmi nCic.cmo nCicEnvironment.cmi
+nCicEnvironment.cmx: nUri.cmx nReference.cmx nCic.cmx nCicEnvironment.cmi
nCicReduction.cmo: nReference.cmi nCicUtils.cmi nCicSubstitution.cmi \
nCicPp.cmi nCicEnvironment.cmi nCic.cmo nCicReduction.cmi
nCicReduction.cmx: nReference.cmx nCicUtils.cmx nCicSubstitution.cmx \
nCicTypeChecker.cmx: nUri.cmx nReference.cmx nCicUtils.cmx \
nCicSubstitution.cmx nCicReduction.cmx nCicPp.cmx nCicEnvironment.cmx \
nCic.cmx nCicTypeChecker.cmi
+nCicLibrary.cmo: oCic2NCic.cmi nUri.cmi nReference.cmi nCicUtils.cmi \
+ nCicUntrusted.cmi nCicEnvironment.cmi nCic2OCic.cmi nCic.cmo \
+ nCicLibrary.cmi
+nCicLibrary.cmx: oCic2NCic.cmx nUri.cmx nReference.cmx nCicUtils.cmx \
+ nCicUntrusted.cmx nCicEnvironment.cmx nCic2OCic.cmx nCic.cmx \
+ nCicLibrary.cmi
nCicUntrusted.cmo: nReference.cmi nCicUtils.cmi nCicSubstitution.cmi \
nCicReduction.cmi nCic.cmo nCicUntrusted.cmi
nCicUntrusted.cmx: nReference.cmx nCicUtils.cmx nCicSubstitution.cmx \
nCicSubstitution.cmi: nCic.cmx
oCic2NCic.cmi: nUri.cmi nReference.cmi nCic.cmx
nCic2OCic.cmi: nUri.cmi nReference.cmi nCic.cmx
-nCicLibrary.cmi: nUri.cmi nReference.cmi nCic.cmx
nCicPp.cmi: nReference.cmi nCic.cmx
nCicEnvironment.cmi: nUri.cmi nReference.cmi nCic.cmx
nCicReduction.cmi: nCic.cmx
nCicTypeChecker.cmi: nUri.cmi nReference.cmi nCic.cmx
-nCicUntrusted.cmi: nUri.cmi nCic.cmx
+nCicLibrary.cmi: nUri.cmi nReference.cmi nCic.cmx
+nCicUntrusted.cmi: nCic.cmx
nCic.cmo: nUri.cmi nReference.cmi
nCic.cmx: nUri.cmx nReference.cmx
nUri.cmo: nUri.cmi
oCic2NCic.cmi
nCic2OCic.cmo: nUri.cmi nReference.cmi nCic.cmx nCic2OCic.cmi
nCic2OCic.cmx: nUri.cmx nReference.cmx nCic.cmx nCic2OCic.cmi
-nCicLibrary.cmo: oCic2NCic.cmi nUri.cmi nReference.cmi nCic2OCic.cmi nCic.cmx \
- nCicLibrary.cmi
-nCicLibrary.cmx: oCic2NCic.cmx nUri.cmx nReference.cmx nCic2OCic.cmx nCic.cmx \
- nCicLibrary.cmi
nCicPp.cmo: nUri.cmi nReference.cmi nCicSubstitution.cmi nCicLibrary.cmi \
- nCic.cmx nCicPp.cmi
+ nCicEnvironment.cmi nCic.cmx nCicPp.cmi
nCicPp.cmx: nUri.cmx nReference.cmx nCicSubstitution.cmx nCicLibrary.cmx \
- nCic.cmx nCicPp.cmi
-nCicEnvironment.cmo: nUri.cmi nReference.cmi nCicLibrary.cmi nCic.cmx \
- nCicEnvironment.cmi
-nCicEnvironment.cmx: nUri.cmx nReference.cmx nCicLibrary.cmx nCic.cmx \
- nCicEnvironment.cmi
+ nCicEnvironment.cmx nCic.cmx nCicPp.cmi
+nCicEnvironment.cmo: nUri.cmi nReference.cmi nCic.cmx nCicEnvironment.cmi
+nCicEnvironment.cmx: nUri.cmx nReference.cmx nCic.cmx nCicEnvironment.cmi
nCicReduction.cmo: nReference.cmi nCicUtils.cmi nCicSubstitution.cmi \
nCicPp.cmi nCicEnvironment.cmi nCic.cmx nCicReduction.cmi
nCicReduction.cmx: nReference.cmx nCicUtils.cmx nCicSubstitution.cmx \
nCicTypeChecker.cmx: nUri.cmx nReference.cmx nCicUtils.cmx \
nCicSubstitution.cmx nCicReduction.cmx nCicPp.cmx nCicEnvironment.cmx \
nCic.cmx nCicTypeChecker.cmi
-nCicUntrusted.cmo: nReference.cmi nCicUtils.cmi nCicTypeChecker.cmi \
- nCicSubstitution.cmi nCicReduction.cmi nCicEnvironment.cmi nCic.cmx \
- nCicUntrusted.cmi
-nCicUntrusted.cmx: nReference.cmx nCicUtils.cmx nCicTypeChecker.cmx \
- nCicSubstitution.cmx nCicReduction.cmx nCicEnvironment.cmx nCic.cmx \
- nCicUntrusted.cmi
+nCicLibrary.cmo: oCic2NCic.cmi nUri.cmi nReference.cmi nCicUtils.cmi \
+ nCicUntrusted.cmi nCicEnvironment.cmi nCic2OCic.cmi nCic.cmx \
+ nCicLibrary.cmi
+nCicLibrary.cmx: oCic2NCic.cmx nUri.cmx nReference.cmx nCicUtils.cmx \
+ nCicUntrusted.cmx nCicEnvironment.cmx nCic2OCic.cmx nCic.cmx \
+ nCicLibrary.cmi
+nCicUntrusted.cmo: nReference.cmi nCicUtils.cmi nCicSubstitution.cmi \
+ nCicReduction.cmi nCic.cmx nCicUntrusted.cmi
+nCicUntrusted.cmx: nReference.cmx nCicUtils.cmx nCicSubstitution.cmx \
+ nCicReduction.cmx nCic.cmx nCicUntrusted.cmi
nCicSubstitution.mli \
oCic2NCic.mli \
nCic2OCic.mli \
- nCicLibrary.mli \
- nCicPp.mli \
nCicEnvironment.mli \
+ nCicPp.mli \
nCicReduction.mli \
nCicTypeChecker.mli \
- nCicUntrusted.mli
+ nCicUntrusted.mli \
+ nCicLibrary.mli
IMPLEMENTATION_FILES = \
nCic.ml $(INTERFACE_FILES:%.mli=%.ml)
exception BadDependency of string Lazy.t * exn;;
exception BadConstraint of string Lazy.t;;
+let get_obj = ref (fun _ -> assert false);;
+let set_get_obj f = get_obj := f;;
+
let type0 = []
let max l1 l2 =
Not_found ->
let saved_frozen_list = !frozen_list in
try
- let obj =
- try NCicLibrary.get_obj u
- with
- NCicLibrary.ObjectNotFound m -> raise (ObjectNotFound m)
- in
- frozen_list := (u,obj)::saved_frozen_list;
- !typecheck_obj obj;
- frozen_list := saved_frozen_list;
- let obj = `WellTyped obj in
- NUri.UriHash.add cache u obj;
- obj
+ let obj = !get_obj u in
+ frozen_list := (u,obj)::saved_frozen_list;
+ !typecheck_obj obj;
+ frozen_list := saved_frozen_list;
+ let obj = `WellTyped obj in
+ NUri.UriHash.add cache u obj;
+ obj
with
Sys.Break as e ->
frozen_list := saved_frozen_list;
exception BadDependency of string Lazy.t * exn;;
exception BadConstraint of string Lazy.t;;
+val set_get_obj: (NUri.uri -> NCic.obj) -> unit
+
val get_checked_obj: NUri.uri -> NCic.obj
val get_relevance: NReference.reference -> bool list
(* $Id$ *)
-exception ObjectNotFound of string Lazy.t
exception LibraryOutOfSync of string Lazy.t
type timestamp =
time_travel time0
;;
+let refresh_uri uri = NUri.uri_of_string (NUri.string_of_uri uri);;
+
+let rec refresh_uri_in_term =
+ function
+ NCic.Const (NReference.Ref (u,spec)) ->
+ NCic.Const (NReference.reference_of_spec (refresh_uri u) spec)
+ | t -> NCicUtils.map (fun _ _ -> ()) () (fun _ -> refresh_uri_in_term) t
+;;
+
+let refresh_uri_in_obj (uri,height,metasenv,subst,obj_kind) =
+ assert (metasenv = []);
+ assert (subst = []);
+ uri,height,metasenv,subst,
+ NCicUntrusted.map_obj_kind refresh_uri_in_term obj_kind
+;;
+
module type Serializer =
sig
type status
(* WE ARE NOT REMOVING ALL THE OBJECTS YET! *)
;;
-(* the miracles of Marshal... *)
let fetch_obj uri =
let obj = require0 ~baseuri:uri in
- (* here we need to refresh the URIs! *)
- obj
+ refresh_uri_in_obj obj
;;
let resolve name =
HExtlib.filter_map
(fun (_,name',nref) -> if name'=name then Some nref else None) !aliases
with
- Not_found -> raise (ObjectNotFound (lazy name))
+ Not_found -> raise (NCicEnvironment.ObjectNotFound (lazy name))
;;
let aliases_of uri =
HExtlib.filter_map
(fun (uri',_,nref) -> if NUri.eq uri' uri then Some nref else None) !aliases
with
- Not_found -> raise (ObjectNotFound (lazy (NUri.string_of_uri uri)))
+ Not_found -> raise (NCicEnvironment.ObjectNotFound (lazy (NUri.string_of_uri uri)))
;;
let add_obj u obj =
List.iter (fun (u,_,_,_,_ as o) -> cache:= NUri.UriMap.add u o !cache) l;
HExtlib.list_last l
with CicEnvironment.Object_not_found u ->
- raise (ObjectNotFound
+ raise (NCicEnvironment.ObjectNotFound
(lazy (NUri.string_of_uri (OCic2NCic.nuri_of_ouri u))))
;;
let clear_cache () = cache := NUri.UriMap.empty;;
+
+NCicEnvironment.set_get_obj get_obj;;
+NCicPp.set_get_obj get_obj;;
(* $Id$ *)
-exception ObjectNotFound of string Lazy.t
exception LibraryOutOfSync of string Lazy.t
type timestamp
val add_obj: NUri.uri -> NCic.obj -> timestamp
val aliases_of: NUri.uri -> NReference.reference list
val resolve: string -> NReference.reference list
+(* warning: get_obj may raise (NCicEnvironment.ObjectNotFoud l) *)
val get_obj: NUri.uri -> NCic.obj (* changes the current timestamp *)
val clear_cache : unit -> unit
let head_beta_reduce = ref (fun ~upto:_ _ -> assert false);;
let set_head_beta_reduce = (:=) head_beta_reduce;;
+let get_obj = ref (fun _ -> assert false);;
+let set_get_obj f = get_obj := f;;
+
let r2s pp_fix_name r =
try
match r with
| R.Ref (u,R.Ind (_,i,_)) ->
- (match NCicLibrary.get_obj u with
+ (match !get_obj u with
| _,_,_,_, C.Inductive (_,_,itl,_) ->
let _,name,_,_ = List.nth itl i in name
| _ -> assert false)
| R.Ref (u,R.Con (i,j,_)) ->
- (match NCicLibrary.get_obj u with
+ (match !get_obj u with
| _,_,_,_, C.Inductive (_,_,itl,_) ->
let _,_,_,cl = List.nth itl i in
let _,name,_ = List.nth cl (j-1) in name
| _ -> assert false)
| R.Ref (u,(R.Decl | R.Def _)) ->
- (match NCicLibrary.get_obj u with
+ (match !get_obj u with
| _,_,_,_, C.Constant (_,name,_,_,_) -> name
| _ -> assert false)
| R.Ref (u,(R.Fix (i,_,_)|R.CoFix i)) ->
- (match NCicLibrary.get_obj u with
+ (match !get_obj u with
| _,_,_,_, C.Fixpoint (_,fl,_) ->
if pp_fix_name then
let _,name,_,_,_ = List.nth fl i in name
NUri.name_of_uri u ^"("^ string_of_int i ^ ")"
| _ -> assert false)
with
- | NCicLibrary.ObjectNotFound _
+ | NCicEnvironment.ObjectNotFound _
| Failure "nth"
| Invalid_argument "List.nth" -> R.string_of_reference r
(* $Id$ *)
val set_head_beta_reduce: (upto:int -> NCic.term -> NCic.term) -> unit
+val set_get_obj: (NUri.uri -> NCic.obj) -> unit
val r2s: bool -> NReference.reference -> string