diff options
author | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2003-04-01 14:03:26 +0000 |
---|---|---|
committer | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2003-04-01 14:03:26 +0000 |
commit | c06a98ffdba666203b90658ba0d0027ad7241617 (patch) | |
tree | 7e90c1f3ebde7fcbeb9bfeff0a6c01e488fd8c84 /lib | |
parent | 3889d04a72ebe669f501c09dfed9ae8647aec446 (diff) |
Déplacement with_option dans Options
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@3835 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r-- | lib/options.ml | 5 | ||||
-rw-r--r-- | lib/options.mli | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/options.ml b/lib/options.ml index 90517561f..7527c82f9 100644 --- a/lib/options.ml +++ b/lib/options.ml @@ -53,6 +53,11 @@ let silently f x = let if_silent f x = if !silent then f x let if_verbose f x = if not !silent then f x +let with_option o f x = + let old = !o in o:=true; + try let r = f x in o := old; r + with e -> o := old; raise e + (* The number of printed hypothesis in a goal *) let print_hyps_limit = ref (None : int option) diff --git a/lib/options.mli b/lib/options.mli index b6b895178..8772d2200 100644 --- a/lib/options.mli +++ b/lib/options.mli @@ -38,6 +38,9 @@ val silently : ('a -> 'b) -> 'a -> 'b val if_silent : ('a -> unit) -> 'a -> unit val if_verbose : ('a -> unit) -> 'a -> unit +(* Temporary activate an option ('c must be an atomic type) *) +val with_option : bool ref -> ('a -> 'b) -> 'a -> 'b + (* If [None], no limit *) val set_print_hyps_limit : int option -> unit val print_hyps_limit : unit -> int option |