aboutsummaryrefslogtreecommitdiffhomepage
path: root/library
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-12-20 19:50:39 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2000-12-20 19:50:39 +0000
commitec66fade3f217897338cb0012eb06145d809edc8 (patch)
treec3f754291748250b6f2508b4697ea4af32e02287 /library
parentbe670deace370127c44e1ee3583e61ed6492382a (diff)
Test pour empêcher 2 sections de même noms
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@1172 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library')
-rw-r--r--library/lib.ml3
-rwxr-xr-xlibrary/nametab.ml3
-rwxr-xr-xlibrary/nametab.mli1
3 files changed, 7 insertions, 0 deletions
diff --git a/library/lib.ml b/library/lib.ml
index 4d95bdce9..53b5a21b0 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -1,6 +1,7 @@
(* $Id$ *)
+open Pp
open Util
open Names
open Libobject
@@ -106,6 +107,8 @@ let contents_after = function
let open_section s =
let sp = make_path (id_of_string s) OBJ in
+ if Nametab.exists_module sp then
+ errorlabstrm "open_section" [< 'sTR (s^" already exists") >];
add_entry sp (OpenedSection (s, freeze_summaries()));
path_prefix := !path_prefix @ [s];
sp
diff --git a/library/nametab.ml b/library/nametab.ml
index 7b92a40cc..57002455b 100755
--- a/library/nametab.ml
+++ b/library/nametab.ml
@@ -164,6 +164,9 @@ let rec rec_open_module_contents qid =
let exists_cci sp =
try let _ = locate (qualid_of_sp sp) in true with Not_found -> false
+let exists_module sp =
+ try let _ = locate_module (qualid_of_sp sp) in true with Not_found -> false
+
(********************************************************************)
(* Registration of persistent tables as a global table and rollback *)
diff --git a/library/nametab.mli b/library/nametab.mli
index 13c6b514b..7f43b9d84 100755
--- a/library/nametab.mli
+++ b/library/nametab.mli
@@ -35,6 +35,7 @@ val locate_module : qualid -> section_path * module_contents
(* [exists sp] tells if [sp] is already bound to a cci term *)
val exists_cci : section_path -> bool
+val exists_module : section_path -> bool
val open_module_contents : qualid -> unit
val rec_open_module_contents : qualid -> unit