aboutsummaryrefslogtreecommitdiff
path: root/library/lib.ml
diff options
context:
space:
mode:
authorppedrot2013-05-12 15:33:40 +0000
committerppedrot2013-05-12 15:33:40 +0000
commitde26e97cf37cafd37b83377d2df062a6e82676e7 (patch)
tree1f093c94b7cb8ab59f301b9c5ee7ca712aa9fa0f /library/lib.ml
parent9a9a8ab4c2a07aa8faa04f50d6250930220b5be5 (diff)
Use the Hook module here and there.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16510 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'library/lib.ml')
-rw-r--r--library/lib.ml11
1 files changed, 4 insertions, 7 deletions
diff --git a/library/lib.ml b/library/lib.ml
index 0ba9fd9193..bf4c0a474b 100644
--- a/library/lib.ml
+++ b/library/lib.ml
@@ -475,11 +475,8 @@ let is_in_section ref =
(* Sections. *)
(* XML output hooks *)
-let xml_open_section = ref (fun id -> ())
-let xml_close_section = ref (fun id -> ())
-
-let set_xml_open_section f = xml_open_section := f
-let set_xml_close_section f = xml_close_section := f
+let (f_xml_open_section, xml_open_section) = Hook.make ~default:ignore ()
+let (f_xml_close_section, xml_close_section) = Hook.make ~default:ignore ()
let open_section id =
let olddir,(mp,oldsec) = !path_prefix in
@@ -493,7 +490,7 @@ let open_section id =
(*Pushed for the lifetime of the section: removed by unfrozing the summary*)
Nametab.push_dir (Nametab.Until 1) dir (DirOpenSection prefix);
path_prefix := prefix;
- if !Flags.xml_export then !xml_open_section id;
+ if !Flags.xml_export then Hook.get f_xml_open_section id;
add_section ()
@@ -522,7 +519,7 @@ let close_section () =
let full_olddir = fst !path_prefix in
pop_path_prefix ();
add_entry oname (ClosedSection (List.rev (mark::secdecls)));
- if !Flags.xml_export then !xml_close_section (basename (fst oname));
+ if !Flags.xml_export then Hook.get f_xml_close_section (basename (fst oname));
let newdecls = List.map discharge_item secdecls in
Summary.unfreeze_summaries fs;
List.iter (Option.iter (fun (id,o) -> add_discharged_leaf id o)) newdecls;