diff options
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 |