From df313cefbaddb57f89650171e59e3abcb168a273 Mon Sep 17 00:00:00 2001 From: herbelin Date: Sun, 5 May 2013 22:47:35 +0000 Subject: Now printing body of abbreviations (i.e. notation with a name) with full usage of notations instead of the previous cheap way to prevent circularity in printing by deactivating all notations. (Since "->" became a notation, printing abbreviations without notations at all had become even more inconvenient). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16470 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/flags.ml | 12 ++++++++++-- lib/flags.mli | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/flags.ml b/lib/flags.ml index d931ad9870..d8355e3e10 100644 --- a/lib/flags.ml +++ b/lib/flags.ml @@ -8,14 +8,22 @@ let with_option o f x = let old = !o in o:=true; + try let r = f x in o := old; r + with reraise -> + let reraise = Backtrace.add_backtrace reraise in + let () = o := old in + raise reraise + +let without_option o f x = + let old = !o in o:=false; try let r = f x in o := old; r with reraise -> let reraise = Backtrace.add_backtrace reraise in let () = o := old in raise reraise -let without_option o f x = - let old = !o in o:=false; +let with_extra_values o l f x = + let old = !o in o:=old@l; try let r = f x in o := old; r with reraise -> let reraise = Backtrace.add_backtrace reraise in diff --git a/lib/flags.mli b/lib/flags.mli index 8ff9deeaae..3965713fe2 100644 --- a/lib/flags.mli +++ b/lib/flags.mli @@ -60,13 +60,16 @@ val is_program_mode : unit -> bool val make_warn : bool -> unit val if_warn : ('a -> unit) -> 'a -> unit -(** Temporary activate an option (to activate option [o] on [f x y z], +(** Temporarily activate an option (to activate option [o] on [f x y z], use [with_option o (f x y) z]) *) val with_option : bool ref -> ('a -> 'b) -> 'a -> 'b -(** Temporary deactivate an option *) +(** Temporarily deactivate an option *) val without_option : bool ref -> ('a -> 'b) -> 'a -> 'b +(** Temporarily extends the reference to a list *) +val with_extra_values : 'c list ref -> 'c list -> ('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