From: Enrico Tassi Date: Thu, 15 May 2008 16:09:17 +0000 (+0000) Subject: New function get_relevance and new (not exported) function get_checked_decl. X-Git-Tag: make_still_working~5196 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=cf4da27b865107f9b89f3d2726f14d6e2694c548;p=helm.git New function get_relevance and new (not exported) function get_checked_decl. --- diff --git a/helm/software/components/ng_kernel/nCicEnvironment.ml b/helm/software/components/ng_kernel/nCicEnvironment.ml index 2b98e8d4f..b491d4c84 100644 --- a/helm/software/components/ng_kernel/nCicEnvironment.ml +++ b/helm/software/components/ng_kernel/nCicEnvironment.ml @@ -81,6 +81,17 @@ let get_checked_obj u = | `Exn e -> raise e ;; +let get_checked_decl = function + | NReference.Ref (uri, NReference.Decl) -> + (match get_checked_obj uri with + | _,height,_,_, NCic.Constant (rlv,name,None,ty,att) -> + rlv,name,ty,att,height + | _,_,_,_, NCic.Constant (_,_,Some _,_,_) -> + prerr_endline "get_checked_decl on a definition"; assert false + | _ -> prerr_endline "get_checked_decl on a non decl 2"; assert false) + | _ -> prerr_endline "get_checked_decl on a non decl"; assert false +;; + let get_checked_def = function | NReference.Ref (uri, NReference.Def _) -> (match get_checked_obj uri with @@ -119,6 +130,27 @@ let get_indty_leftno = function | _ -> prerr_endline "get_indty_leftno called on a non indty";assert false ;; +let get_relevance (NReference.Ref (_, infos) as r) = + match infos with + NReference.Def _ -> let res,_,_,_,_,_ = get_checked_def r in res + | NReference.Decl -> let res,_,_,_,_ = get_checked_decl r in res + | NReference.Ind _ -> + let _,_,tl,_,n = get_checked_indtys r in + let res,_,_,_ = List.nth tl n in + res + | NReference.Con (_,i) -> + let _,_,tl,_,n = get_checked_indtys r in + let _,_,_,cl = List.nth tl n in + let res,_,_ = List.nth cl (i - 1) in + res + | NReference.Fix (fixno,_,_) + | NReference.CoFix fixno -> + let fl,_,_ = get_checked_fixes_or_cofixes r in + let res,_,_,_,_ = List.nth fl fixno in + res +;; + + let invalidate _ = assert (!frozen_list = []); NUri.UriHash.clear cache diff --git a/helm/software/components/ng_kernel/nCicEnvironment.mli b/helm/software/components/ng_kernel/nCicEnvironment.mli index 3e2cbff28..048dd7b96 100644 --- a/helm/software/components/ng_kernel/nCicEnvironment.mli +++ b/helm/software/components/ng_kernel/nCicEnvironment.mli @@ -17,6 +17,8 @@ exception BadDependency of string Lazy.t;; val get_checked_obj: NUri.uri -> NCic.obj +val get_relevance: NReference.reference -> bool list + val get_checked_def: NReference.reference -> NCic.relevance * string * NCic.term * NCic.term * NCic.c_attr * int