From c06a98ffdba666203b90658ba0d0027ad7241617 Mon Sep 17 00:00:00 2001 From: herbelin Date: Tue, 1 Apr 2003 14:03:26 +0000 Subject: Déplacement with_option dans Options git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@3835 85f007b7-540e-0410-9357-904b9bb8a0f7 --- interp/constrextern.ml | 17 ++++++----------- lib/options.ml | 5 +++++ lib/options.mli | 3 +++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/interp/constrextern.ml b/interp/constrextern.ml index cd0d99581e..cc5e79a126 100644 --- a/interp/constrextern.ml +++ b/interp/constrextern.ml @@ -60,17 +60,12 @@ let print_no_symbol = ref false let print_meta_as_hole = ref false -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 - -let with_arguments f = with_option print_arguments f -let with_implicits f = with_option print_implicits f -let with_coercions f = with_option print_coercions f -let with_universes f = with_option print_universes f -let without_symbols f = with_option print_no_symbol f -let with_meta_as_hole f = with_option print_meta_as_hole f +let with_arguments f = Options.with_option print_arguments f +let with_implicits f = Options.with_option print_implicits f +let with_coercions f = Options.with_option print_coercions f +let with_universes f = Options.with_option print_universes f +let without_symbols f = Options.with_option print_no_symbol f +let with_meta_as_hole f = Options.with_option print_meta_as_hole f (**********************************************************************) (* Various externalisation functions *) diff --git a/lib/options.ml b/lib/options.ml index 90517561f1..7527c82f92 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 b6b8951782..8772d22008 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 -- cgit v1.2.3