aboutsummaryrefslogtreecommitdiffhomepage
path: root/library
diff options
context:
space:
mode:
authorGravatar notin <notin@85f007b7-540e-0410-9357-904b9bb8a0f7>2006-05-23 17:52:43 +0000
committerGravatar notin <notin@85f007b7-540e-0410-9357-904b9bb8a0f7>2006-05-23 17:52:43 +0000
commit582b5147cb79267ce79c03718cb3575826dc831c (patch)
treef977188d312537e383cadaf33b206aef8d668d2b /library
parent67d9bf01b77bf479126dee6b47318618831ef3fc (diff)
Modification de add_glob (support des modules dans Coqdoc)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@8852 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library')
-rw-r--r--library/lib.ml18
-rw-r--r--library/lib.mli1
2 files changed, 19 insertions, 0 deletions
diff --git a/library/lib.ml b/library/lib.ml
index ca054c8d6..0b383b34d 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -624,6 +624,24 @@ let reset_initial () =
(* Misc *)
+let mp_of_global ref =
+ match ref with
+ | VarRef id -> fst (current_prefix ())
+ | ConstRef cst -> con_modpath cst
+ | IndRef ind -> ind_modpath ind
+ | ConstructRef constr -> constr_modpath constr
+
+let rec dp_of_mp modp =
+ match modp with
+ | MPfile dp -> dp
+ | MPbound _ | MPself _ -> library_dp ()
+ | MPdot (mp,_) -> dp_of_mp mp
+
+let library_part ref =
+ match ref with
+ | VarRef id -> library_dp ()
+ | _ -> dp_of_mp (mp_of_global ref)
+
let remove_section_part ref =
let sp = Nametab.sp_of_global ref in
let dir,_ = repr_path sp in
diff --git a/library/lib.mli b/library/lib.mli
index 6552cda6a..52e6b7bd7 100644
--- a/library/lib.mli
+++ b/library/lib.mli
@@ -122,6 +122,7 @@ val end_compilation : dir_path -> object_prefix * library_segment
val library_dp : unit -> dir_path
(* Extract the library part of a name even if in a section *)
+val library_part : global_reference -> dir_path
val remove_section_part : global_reference -> dir_path
(*s Sections *)