module C = NCic
module Ref = NReference
+let debug = ref false;;
let indent = ref "";;
-let inside c = indent := !indent ^ String.make 1 c;;
-let outside () = indent := String.sub !indent 0 (String.length !indent -1);;
+let pp s =
+ if !debug then
+ prerr_endline (Printf.sprintf "%-20s" !indent ^ " " ^ Lazy.force s)
+ else
+ ()
+;;
+let inside c =
+ indent := !indent ^ String.make 1 c;
+ if !debug then prerr_endline ("{{{" ^ !indent ^ " ")
+;;
+let outside ok =
+ if !debug then prerr_endline "}}}";
+ if not ok then pp (lazy "exception raised!");
+ try
+ indent := String.sub !indent 0 (String.length !indent -1)
+ with
+ Invalid_argument _ -> indent := "??"; ()
+;;
-let debug = ref false;;
-let pp s =
- if !debug then
- prerr_endline (Printf.sprintf "%-20s" !indent ^ " " ^ Lazy.force s)
- else
- ()
-;;
let wrap_exc msg = function
| NCicUnification.Uncertain _ -> Uncertain msg
with exc -> raise (wrap_exc (lazy (localise orig,
"Sort elimination not allowed ")) exc))
| _ -> assert false
- (*D*)in outside(); rc with exc -> outside (); raise exc
+ (*D*)in outside true; rc with exc -> outside false; raise exc
in
aux
;;
let metasenv, subst =
(*D*)inside 'U'; try let rc =
NCicUnification.unify rdb metasenv subst context infty expty
- (*D*)in outside(); rc with exc -> outside (); raise exc
+ (*D*)in outside true; rc with exc -> outside false; raise exc
in
metasenv, subst, t, expty
with
try_coercions rdb ~localise
metasenv subst context t orig infty expty true exc)
| None -> metasenv, subst, t, infty
- (*D*)in outside(); rc with exc -> outside (); raise exc
+ (*D*)in outside true; rc with exc -> outside false; raise exc
in
let rec typeof_aux metasenv subst context expty =
fun t as orig ->
pp (lazy (NCicPp.ppterm ~metasenv ~subst ~context t ^ " ::inf:: "^
NCicPp.ppterm ~metasenv ~subst ~context infty ));
force_ty true true metasenv subst context orig t infty expty
- (*D*)in outside(); rc with exc -> outside (); raise exc
+ (*D*)in outside true; rc with exc -> outside false; raise exc
in
typeof_aux metasenv subst context expty term
List.partition (fun (i,_) -> i <= highest_meta) metasenv
in
(List.rev metasenv_new) @ metasenv_old, subst, newhead, newheadty
- (*D*)in outside(); rc with exc -> outside (); raise exc
+ (*D*)in outside true; rc with exc -> outside false; raise exc
;;
let rec first f l1 l2 =
(fun _ -> MatitaGui.all_disambiguation_passes := false);
addDebugSeparator ();
addDebugItem "enable refiner/unification logging"
- (fun _ -> NCicRefiner.debug := true; NCicUnification.debug := true;);
+ (fun _ -> NCicRefiner.debug := true; NCicUnification.debug := true; MultiPassDisambiguator.debug := true);
addDebugItem "disable refiner/unification logging"
- (fun _ -> NCicRefiner.debug := false; NCicUnification.debug := false;);
+ (fun _ -> NCicRefiner.debug := false; NCicUnification.debug := false; MultiPassDisambiguator.debug := false);
addDebugSeparator ();
addDebugItem "enable reduction logging"
(fun _ -> NCicReduction.debug := true);