+let new_proof (proof: MatitaTypes.proof) =
+ let xmldump_observer _ _ = print_endline proof#toString in
+ let proof_observer _ (status, ()) =
+ debug_print "proof_observer";
+ let ((uri_opt, _, _, _), _) = status in
+ let uri = MatitaTypes.unopt_uri uri_opt in
+ debug_print "apply transformation";
+ proof_viewer#load_proof status;
+ debug_print "/proof_observer"
+ in
+ let sequents_observer _ (((_, metasenv, _, _), goal_opt), ()) =
+ sequents_viewer#reset;
+ (match goal_opt with
+ | None -> ()
+ | Some goal ->
+ sequents_viewer#load_sequents metasenv;
+ sequents_viewer#goto_sequent goal)
+ in
+ ignore (proof#attach_observer ~interested_in:StatefulProofEngine.all_events
+ sequents_observer);
+ ignore (proof#attach_observer ~interested_in:StatefulProofEngine.all_events
+ proof_observer);
+ ignore (proof#attach_observer ~interested_in:StatefulProofEngine.all_events
+ xmldump_observer);
+ proof#notify;
+ set_proof (Some proof)
+
+let quit () = (* quit program, asking for confirmation if needed *)
+ if not (has_proof ()) ||
+ (ask_confirmation ~gui
+ ~msg:("Proof in progress, are you sure you want to quit?") ())
+ then
+ GMain.Main.quit ()
+
+let abort_proof () =
+ if has_proof () then begin
+ set_proof None;
+ sequents_viewer#reset
+ end
+
+let proof_handler =
+ { MatitaTypes.get_proof = get_proof;
+ MatitaTypes.abort_proof = abort_proof;
+ MatitaTypes.set_proof = set_proof;
+ MatitaTypes.has_proof = has_proof;
+ MatitaTypes.new_proof = new_proof;
+ MatitaTypes.quit = quit;
+ }
+
+let interpreter =
+ let console = gui#console in
+ new MatitaInterpreter.interpreter ~disambiguator ~proof_handler ~console ()