blob: b86c08f72935d88d787e43d9e1cc92dcebe012e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
(***********************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA-Rocquencourt & LRI-CNRS-Orsay *)
(* \VV/ *************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(***********************************************************************)
(*i $Id$ i*)
(*i*)
open Names
open Libobject
open Summary
(*i*)
(*s This module provides a general mechanism to keep a trace of all operations
and to backtrack (undo) those operations. It provides also the section
mechanism (at a low level; discharge is not known at this step). *)
type node =
| Leaf of obj
| Module of dir_path
| OpenedSection of dir_path * Summary.frozen
| ClosedSection of bool * dir_path * library_segment
| FrozenState of Summary.frozen
and library_entry = section_path * node
and library_segment = library_entry list
(*s Adding operations (which calls the [cache] method, and getting the
current list of operations (most recent ones coming first). *)
val add_leaf : identifier -> obj -> section_path
val add_absolutely_named_leaf : section_path -> obj -> unit
val add_anonymous_leaf : obj -> unit
val add_frozen_state : unit -> unit
val mark_end_of_command : unit -> unit
(*s The function [contents_after] returns the current library segment,
starting from a given section path. If not given, the entire segment
is returned. *)
val contents_after : section_path option -> library_segment
(*s Opening and closing a section. *)
val open_section : identifier -> section_path
val close_section :
export:bool -> identifier -> dir_path * library_segment * Summary.frozen
val sections_are_opened : unit -> bool
val make_path : identifier -> section_path
val cwd : unit -> dir_path
val sections_depth : unit -> int
val is_section_p : dir_path -> bool
val start_module : dir_path -> unit
val end_module : module_ident -> dir_path
val export_module : dir_path -> library_segment
(*s Backtracking (undo). *)
val reset_to : section_path -> unit
val reset_name : identifier -> unit
val back : int -> unit
(*s We can get and set the state of the operations (used in [States]). *)
type frozen
val freeze : unit -> frozen
val unfreeze : frozen -> unit
val init : unit -> unit
val declare_initial_state : unit -> unit
val reset_initial : unit -> unit
|