open MatitaTypes
+ (** If set to true matitac wont catch top level exception, so that backtrace
+ * could be inspected setting OCAMLRUNPARAM=b.
+ * This flag could be enabled passing -debug *)
+let debug = ref false
+
(** {2 Initialization} *)
let paths_to_search_in = ref [];;
let dont_delete_baseuri = ref false;;
let add_l l = fun s -> l := s :: !l ;;
-let set_b b = fun () -> b := true;;
let arg_spec = [
"-I", Arg.String (add_l paths_to_search_in),
"<path> Adds path to the list of searched paths for the include command";
- "-q", Arg.Unit (set_b quiet_compilation), "Turn off verbose compilation";
- "-preserve", Arg.Unit (set_b dont_delete_baseuri),
- "Turns off automatic baseuri cleaning"
+ "-q", Arg.Set quiet_compilation, "Turn off verbose compilation";
+ "-preserve", Arg.Set dont_delete_baseuri,
+ "Turns off automatic baseuri cleaning";
+ "-debug", Arg.Set debug,
+ "Do not catch top-level exception (useful for backtrace inspection)";
]
let usage =
sprintf "MatitaC v%s\nUsage: matitac [option ...] file\nOptions:"
clean_exit (Some 1)
else
pp_ocaml_mode ()
- | _ ->
- if mode = `COMPILER then
- clean_exit (Some 3)
- else
- pp_ocaml_mode ()
+ | exn ->
+ if !debug then raise exn;
+ if mode = `COMPILER then
+ clean_exit (Some 3)
+ else
+ pp_ocaml_mode ()
+