diff options
author | 2010-12-01 11:53:25 +0100 | |
---|---|---|
committer | 2010-12-01 11:53:25 +0100 | |
commit | 9e28c50232e56e35437afb468c6d273abcf5eab5 (patch) | |
tree | 5683a9003d284a2b346491ebf276f67c3ec733fa /AAC_helper.ml | |
parent | 1aa8b6f6a876af22f538c869f022bc4ca5986b40 (diff) |
Imported Upstream version 0.2upstream/0.2
Diffstat (limited to 'AAC_helper.ml')
-rw-r--r-- | AAC_helper.ml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/AAC_helper.ml b/AAC_helper.ml new file mode 100644 index 0000000..15372f2 --- /dev/null +++ b/AAC_helper.ml @@ -0,0 +1,41 @@ +(***************************************************************************) +(* This is part of aac_tactics, it is distributed under the terms of the *) +(* GNU Lesser General Public License version 3 *) +(* (see file LICENSE for more details) *) +(* *) +(* Copyright 2009-2010: Thomas Braibant, Damien Pous. *) +(***************************************************************************) + +module type CONTROL = sig + val debug : bool + val time : bool + val printing : bool +end + +module Debug (X : CONTROL) = struct + open X + let debug x = + if debug then + Printf.printf "%s\n%!" x + + + let time f x fmt = + if time then + let t = Sys.time () in + let r = f x in + Printf.printf fmt (Sys.time () -. t); + r + else f x + + let pr_constr msg constr = + if printing then + ( Pp.msgnl (Pp.str (Printf.sprintf "=====%s====" msg)); + Pp.msgnl (Printer.pr_constr constr); + ) + + + let debug_exception msg e = + debug (msg ^ (Printexc.to_string e)) + + +end |