let freshen_term = freshen_term ?index:None
-let refresh_uri_in_term t = assert false
+let rec refresh_uri_in_term ~refresh_uri_in_term:refresh_in_cic
+ ~refresh_uri_in_reference
+=
+ function
+ NotationPt.NRef ref -> NotationPt.NRef (refresh_uri_in_reference ref)
+ | NotationPt.NCic t -> NotationPt.NCic (refresh_in_cic t)
+ | t ->
+ visit_ast
+ (refresh_uri_in_term ~refresh_uri_in_term:refresh_in_cic
+ ~refresh_uri_in_reference) t
+ ~special_k:(fun x -> x)
+ ~map_xref_option:(function Some ref -> Some (refresh_uri_in_reference ref)
+ | x -> x)
+ ~map_case_indty:(function (Some (s,Some ref)) -> Some (s, Some
+ (refresh_uri_in_reference ref)) | x -> x)
+;;
val fresh_id: unit -> notation_id
-val refresh_uri_in_term: NotationPt.term -> NotationPt.term
+val refresh_uri_in_term:
+ refresh_uri_in_term:(NCic.term -> NCic.term) ->
+ refresh_uri_in_reference:(NReference.reference -> NReference.reference) ->
+ NotationPt.term -> NotationPt.term
type checked_l1_pattern = CL1P of NotationPt.term * int
-let refresh_uri_in_checked_l1_pattern (CL1P (t,n)) =
- CL1P (NotationUtil.refresh_uri_in_term t, n)
+let refresh_uri_in_checked_l1_pattern ~refresh_uri_in_term
+ ~refresh_uri_in_reference (CL1P (t,n))
+=
+ CL1P (NotationUtil.refresh_uri_in_term ~refresh_uri_in_term
+ ~refresh_uri_in_reference t, n)
type binding =
| NoBinding
type checked_l1_pattern = private CL1P of NotationPt.term * int
-val refresh_uri_in_checked_l1_pattern: checked_l1_pattern -> checked_l1_pattern
+val refresh_uri_in_checked_l1_pattern:
+ refresh_uri_in_term:(NCic.term -> NCic.term) ->
+ refresh_uri_in_reference:(NReference.reference -> NReference.reference) ->
+ checked_l1_pattern -> checked_l1_pattern
(** {2 Parsing functions} *)
let inject_unification_hint =
let basic_eval_unification_hint (t,n)
- ~refresh_uri_in_universe
- ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
=
let t = refresh_uri_in_term t in basic_eval_unification_hint (t,n)
in
let inject_interpretation =
let basic_eval_interpretation (dsc, (symbol, args), cic_appl_pattern)
- ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
=
let rec refresh =
function
;;
let inject_alias =
- let basic_eval_alias (mode,diff) ~refresh_uri_in_universe ~refresh_uri_in_term=
+ let basic_eval_alias (mode,diff) ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_reference =
basic_eval_alias (mode,diff)
in
GrafiteTypes.Serializer.register#run "alias" basic_eval_alias
let inject_input_notation =
let basic_eval_input_notation (l1,l2)
- ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
=
- let l1 = CicNotationParser.refresh_uri_in_checked_l1_pattern l1 in
- let l2 = NotationUtil.refresh_uri_in_term l2 in
+ let l1 =
+ CicNotationParser.refresh_uri_in_checked_l1_pattern
+ ~refresh_uri_in_term ~refresh_uri_in_reference l1 in
+ let l2 = NotationUtil.refresh_uri_in_term
+ ~refresh_uri_in_term ~refresh_uri_in_reference l2
+ in
basic_eval_input_notation (l1,l2)
in
GrafiteTypes.Serializer.register#run "input_notation"
let inject_output_notation =
let basic_eval_output_notation (l1,l2)
- ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
=
- let l1 = CicNotationParser.refresh_uri_in_checked_l1_pattern l1 in
- let l2 = NotationUtil.refresh_uri_in_term l2 in
+ let l1 =
+ CicNotationParser.refresh_uri_in_checked_l1_pattern
+ ~refresh_uri_in_term ~refresh_uri_in_reference l1 in
+ let l2 = NotationUtil.refresh_uri_in_term
+ ~refresh_uri_in_term ~refresh_uri_in_reference l2
+ in
basic_eval_output_notation (l1,l2)
in
GrafiteTypes.Serializer.register#run "output_notation"
;;
let record_index_obj =
- let aux l
- ~refresh_uri_in_universe
- ~refresh_uri_in_term
+ let aux l ~refresh_uri_in_universe
+ ~refresh_uri_in_term ~refresh_uri_in_reference
=
basic_index_obj
(List.map
let record_index_eq =
let basic_index_eq uri
- ~refresh_uri_in_universe
- ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
= index_eq (NCicLibrary.refresh_uri uri)
in
GrafiteTypes.Serializer.register#run "index_eq" basic_index_eq
let inject_constraint =
let basic_eval_add_constraint (u1,u2)
- ~refresh_uri_in_universe
- ~refresh_uri_in_term
+ ~refresh_uri_in_universe ~refresh_uri_in_term ~refresh_uri_in_reference
=
let u1 = refresh_uri_in_universe u1 in
let u2 = refresh_uri_in_universe u2 in
;;
let record_ncoercion =
- let aux (name,t,s,d,p,a) ~refresh_uri_in_universe ~refresh_uri_in_term =
+ let aux (name,t,s,d,p,a) ~refresh_uri_in_term =
let t = refresh_uri_in_term t in
let s = refresh_uri_in_term s in
let d = refresh_uri_in_term d in
basic_index_ncoercion (name,t,s,d,p,a)
in
- let aux_l l ~refresh_uri_in_universe ~refresh_uri_in_term =
- List.fold_right (aux ~refresh_uri_in_universe ~refresh_uri_in_term) l
+ let aux_l l ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_reference
+ =
+ List.fold_right (aux ~refresh_uri_in_term) l
in
GrafiteTypes.Serializer.register#run "ncoercion" aux_l
;;
List.map (fun (x,u) -> x, refresh_uri u)
;;
+let refresh_uri_in_reference (NReference.Ref (uri,spec)) =
+ NReference.reference_of_spec (refresh_uri uri) spec
+
let rec refresh_uri_in_term =
function
| NCic.Meta (i,(n,NCic.Ctx l)) ->
NCic.Meta (i,(n,NCic.Ctx (List.map refresh_uri_in_term l)))
| NCic.Meta _ as t -> t
- | NCic.Const (NReference.Ref (u,spec)) ->
- NCic.Const (NReference.reference_of_spec (refresh_uri u) spec)
+ | NCic.Const ref -> NCic.Const (refresh_uri_in_reference ref)
| NCic.Sort (NCic.Type l) -> NCic.Sort (NCic.Type (refresh_uri_in_universe l))
| NCic.Match (NReference.Ref (uri,spec),outtype,term,pl) ->
let r = NReference.reference_of_spec (refresh_uri uri) spec in
'a ->
refresh_uri_in_universe:(NCic.universe -> NCic.universe) ->
refresh_uri_in_term:(NCic.term -> NCic.term) ->
+ refresh_uri_in_reference:(NReference.reference -> NReference.reference) ->
dumpable_status -> dumpable_status
val register: < run: 'a. string -> 'a register_type -> ('a -> obj) >
'a ->
refresh_uri_in_universe:(NCic.universe -> NCic.universe) ->
refresh_uri_in_term:(NCic.term -> NCic.term) ->
+ refresh_uri_in_reference:(NReference.reference -> NReference.reference) ->
dumpable_status -> dumpable_status
let require1 = ref (fun _ -> assert false) (* unknown data*)
(fun ((tag',data) as x) ->
if tag=tag' then
require (Obj.magic data) ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_reference
else
old_require1 x);
(fun x -> tag,Obj.repr x)
raise (IncludedFileNotCompiled(path_of_baseuri baseuri,NUri.string_of_uri baseuri))
let record_include =
- let aux baseuri ~refresh_uri_in_universe ~refresh_uri_in_term =
+ let aux baseuri ~refresh_uri_in_universe ~refresh_uri_in_term
+ ~refresh_uri_in_reference =
(* memorizzo baseuri in una tabella; *)
require2 ~baseuri
in
'a ->
refresh_uri_in_universe:(NCic.universe -> NCic.universe) ->
refresh_uri_in_term:(NCic.term -> NCic.term) ->
+ refresh_uri_in_reference:(NReference.reference -> NReference.reference) ->
dumpable_status -> dumpable_status
val register: < run: 'a. string -> 'a register_type -> ('a -> obj) >