diff options
author | Samuel Mimram <samuel.mimram@ens-lyon.org> | 2004-07-28 21:54:47 +0000 |
---|---|---|
committer | Samuel Mimram <samuel.mimram@ens-lyon.org> | 2004-07-28 21:54:47 +0000 |
commit | 6b649aba925b6f7462da07599fe67ebb12a3460e (patch) | |
tree | 43656bcaa51164548f3fa14e5b10de5ef1088574 /library/states.ml |
Imported Upstream version 8.0pl1upstream/8.0pl1
Diffstat (limited to 'library/states.ml')
-rw-r--r-- | library/states.ml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/library/states.ml b/library/states.ml new file mode 100644 index 00000000..7a7f1e06 --- /dev/null +++ b/library/states.ml @@ -0,0 +1,39 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *) +(* \VV/ **************************************************************) +(* // * This file is distributed under the terms of the *) +(* * GNU Lesser General Public License Version 2.1 *) +(************************************************************************) + +(* $Id: states.ml,v 1.8.14.1 2004/07/16 19:30:36 herbelin Exp $ *) + +open System + +type state = Lib.frozen * Summary.frozen + +let get_state () = + (Lib.freeze(), Summary.freeze_summaries()) + +let set_state (fl,fs) = + Lib.unfreeze fl; + Summary.unfreeze_summaries fs + +let state_magic_number = 19764 + +let (extern_state,intern_state) = + let (raw_extern, raw_intern) = extern_intern state_magic_number ".coq" in + (fun s -> raw_extern s (get_state())), + (fun s -> set_state (raw_intern (Library.get_load_path ()) s)) + +(* Rollback. *) + +let freeze = get_state +let unfreeze = set_state + +let with_heavy_rollback f x = + let st = get_state () in + try + f x + with reraise -> + (set_state st; raise reraise) |