diff options
author | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2005-02-20 18:13:28 +0000 |
---|---|---|
committer | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2005-02-20 18:13:28 +0000 |
commit | 4231d1907b1277bb45e86909a07d6fc893fa89fa (patch) | |
tree | a0fc5227294ab87f2319e53cfff05210841481f4 | |
parent | 5be5a0ff384bbac3bc529860793e975189c3c110 (diff) |
Keep ClosedSection marker for reset
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@6758 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r-- | library/declaremods.ml | 6 | ||||
-rw-r--r-- | library/declaremods.mli | 5 | ||||
-rw-r--r-- | library/lib.ml | 36 | ||||
-rw-r--r-- | library/lib.mli | 7 | ||||
-rw-r--r-- | parsing/prettyp.ml | 6 | ||||
-rw-r--r-- | parsing/search.ml | 2 | ||||
-rw-r--r-- | toplevel/vernacentries.ml | 4 |
7 files changed, 18 insertions, 48 deletions
diff --git a/library/declaremods.ml b/library/declaremods.ml index dcda0bf25..69aea75f8 100644 --- a/library/declaremods.ml +++ b/library/declaremods.ml @@ -783,7 +783,7 @@ let declare_module interp_modtype interp_modexpr id args mty_o mexpr_o = (*s Iterators. *) -let iter_all_segments insec f = +let iter_all_segments f = let _ = MPmap.iter (fun _ (prefix,objects) -> @@ -793,13 +793,11 @@ let iter_all_segments insec f = in let rec apply_node = function | sp, Leaf o -> f sp o - | _, ClosedSection (_,_,seg) -> if insec then List.iter apply_node seg | _ -> () in List.iter apply_node (Lib.contents_after None) - let debug_print_modtab _ = let pr_seg = function | [] -> str "[]" @@ -811,5 +809,3 @@ let debug_print_modtab _ = in let modules = MPmap.fold pr_modinfo !modtab_objects (mt ()) in hov 0 modules - - diff --git a/library/declaremods.mli b/library/declaremods.mli index 394f8d65b..2a491b4a6 100644 --- a/library/declaremods.mli +++ b/library/declaremods.mli @@ -99,10 +99,9 @@ val import_module : bool -> module_path -> unit (*s [iter_all_segments] iterate over all segments, the modules' segments first and then the current segment. Modules are presented in an arbitrary order. The given function is applied to all leaves - (together with their section path). The boolean indicates if we - must enter closed sections. *) + (together with their section path). *) -val iter_all_segments : bool -> (object_name -> obj -> unit) -> unit +val iter_all_segments : (object_name -> obj -> unit) -> unit val debug_print_modtab : unit -> Pp.std_ppcmds diff --git a/library/lib.ml b/library/lib.ml index 548b80d42..f713d0414 100644 --- a/library/lib.ml +++ b/library/lib.ml @@ -24,8 +24,7 @@ type node = | OpenedModule of bool option * object_prefix * Summary.frozen | OpenedModtype of object_prefix * Summary.frozen | OpenedSection of object_prefix * Summary.frozen - (* bool is to tell if the section must be opened automatically *) - | ClosedSection of bool * dir_path * library_segment + | ClosedSection | FrozenState of Summary.frozen and library_entry = object_name * node @@ -61,7 +60,7 @@ let classify_segment seg = clean ((id,o')::substl, keepl, anticipl) stk | Anticipate o' -> clean (substl, keepl, o'::anticipl) stk) - | (oname,ClosedSection _ as item) :: stk -> clean acc stk + | (oname,ClosedSection) :: stk -> clean acc stk | (_,OpenedSection _) :: _ -> error "there are still opened sections" | (_,OpenedModule _) :: _ -> error "there are still opened modules" | (_,OpenedModtype _) :: _ -> error "there are still opened module types" @@ -215,23 +214,6 @@ let is_something_opened = function | (_,OpenedModtype _) -> true | _ -> false -(* -let export_segment seg = - let rec clean acc = function - | (_,CompilingLibrary _) :: _ | [] -> acc - | (oname,Leaf o) as node :: stk -> - (match export_object o with - | None -> clean acc stk - | Some o' -> clean ((oname,Leaf o') :: acc) stk) - | (oname,ClosedSection _ as item) :: stk -> clean (item :: acc) stk - | (_,OpenedSection _) :: _ -> error "there are still opened sections" - | (_,OpenedModule _) :: _ -> error "there are still opened modules" - | (_,OpenedModtype _) :: _ -> error "there are still opened module types" - | (_,FrozenState _) :: stk -> clean acc stk - in - clean [] seg -*) - let start_module export id mp nametab = let dir = extend_dirpath (fst !path_prefix) id in let prefix = dir,(mp,empty_dirpath) in @@ -468,8 +450,7 @@ let open_section id = Nametab.push_dir (Nametab.Until 1) dir (DirOpenSection prefix); path_prefix := prefix; if !Options.xml_export then !xml_open_section id; - add_section (); - prefix + add_section () (* Restore lib_stk and summaries as before the section opening, and @@ -481,7 +462,7 @@ let discharge_item = function | _ -> None -let close_section ~export id = +let close_section id = let oname,fs = try match find_entry_p is_something_opened with | oname,OpenedSection (_,fs) -> @@ -496,12 +477,7 @@ let close_section ~export id = lib_stk := before; let full_olddir = fst !path_prefix in pop_path_prefix (); -(* - let closed_sec = - ClosedSection (export, full_olddir, export_segment secdecls) in - let name = make_path id, make_kn id in - add_entry name closed_sec; -*) + add_entry (make_oname id) ClosedSection; if !Options.xml_export then !xml_close_section id; let newdecls = List.map discharge_item secdecls in Summary.section_unfreeze_summaries fs; @@ -544,7 +520,7 @@ let reset_name (loc,id) = let is_mod_node = function | OpenedModule _ | OpenedModtype _ | OpenedSection _ - | ClosedSection _ -> true + | ClosedSection -> true | Leaf o -> let t = object_tag o in t = "MODULE" || t = "MODULE TYPE" | _ -> false diff --git a/library/lib.mli b/library/lib.mli index 9a4a810ae..500d01e2c 100644 --- a/library/lib.mli +++ b/library/lib.mli @@ -27,7 +27,7 @@ type node = | OpenedModule of bool option * object_prefix * Summary.frozen | OpenedModtype of object_prefix * Summary.frozen | OpenedSection of object_prefix * Summary.frozen - | ClosedSection of bool * dir_path * library_segment + | ClosedSection | FrozenState of Summary.frozen and library_segment = (object_name * node) list @@ -126,9 +126,8 @@ val library_part : global_reference -> dir_path (*s Sections *) -val open_section : identifier -> object_prefix - -val close_section : export:bool -> identifier -> unit +val open_section : identifier -> unit +val close_section : identifier -> unit (*s Backtracking (undo). *) diff --git a/parsing/prettyp.ml b/parsing/prettyp.ml index eded75be9..2122e3a8f 100644 --- a/parsing/prettyp.ml +++ b/parsing/prettyp.ml @@ -390,7 +390,7 @@ let rec print_library_entry with_values ent = print_leaf_entry with_values sep (oname,lobj) | (oname,Lib.OpenedSection (dir,_)) -> Some (str " >>>>>>> Section " ++ pr_name oname) - | (oname,Lib.ClosedSection _) -> + | (oname,Lib.ClosedSection) -> Some (str " >>>>>>> Closed Section " ++ pr_name oname) | (_,Lib.CompilingLibrary (dir,_)) -> Some (str " >>>>>>> Library " ++ pr_dirpath dir) @@ -440,9 +440,9 @@ let read_sec_context r = with Not_found -> user_err_loc (loc,"read_sec_context", str "Unknown section") in let rec get_cxt in_cxt = function - | ((_,Lib.OpenedSection ((dir',_),_)) as hd)::rest -> + | (_,Lib.OpenedSection ((dir',_),_) as hd)::rest -> if dir = dir' then (hd::in_cxt) else get_cxt (hd::in_cxt) rest - | ((_,Lib.ClosedSection (_,_,ctxt)) as hd)::rest -> + | (_,Lib.ClosedSection)::rest -> error "Cannot print the contents of a closed section" | [] -> [] | hd::rest -> get_cxt (hd::in_cxt) rest diff --git a/parsing/search.ml b/parsing/search.ml index da57d9002..84022e7b1 100644 --- a/parsing/search.ml +++ b/parsing/search.ml @@ -80,7 +80,7 @@ let gen_crible refopt (fn : global_reference -> env -> constr -> unit) = | _ -> () in try - Declaremods.iter_all_segments false crible_rec + Declaremods.iter_all_segments crible_rec with Not_found -> () diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml index 7bb152516..c5839ca7d 100644 --- a/toplevel/vernacentries.ml +++ b/toplevel/vernacentries.ml @@ -462,9 +462,9 @@ let vernac_record struc binders sort nameopt cfs = (* Sections *) -let vernac_begin_section id = let _ = Lib.open_section id in () +let vernac_begin_section = Lib.open_section -let vernac_end_section id = Lib.close_section false id +let vernac_end_section = Lib.close_section let vernac_end_segment id = check_no_pending_proofs (); |