]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitacLib.ml
* new interface matitaTypes.mli
[helm.git] / helm / matita / matitacLib.ml
index fbc393cfb3bed6472ae6de4874975b3786c632ff..ec722490ab07863238622c7e1f0d2cda14ddbaa9 100644 (file)
@@ -98,6 +98,14 @@ let rec go () =
       MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err);
       go ()
   | exn -> MatitaLog.error (Printexc.to_string exn); go ()
+
+let clean_exit n =
+ match !status with
+    None -> exit n
+  | Some status ->
+     let baseuri = MatitaTypes.get_string_option !status "baseuri" in
+      MatitacleanLib.clean_baseuris ~verbose:false [baseuri];
+      exit n
   
 let main ~mode = 
   Helm_registry.load_from "matita.conf.xml";
@@ -140,7 +148,7 @@ let main ~mode =
      begin
       MatitaLog.error
        "there are still incomplete proofs at the end of the script";
-      exit 2
+      clean_exit 2
      end
     else
      begin
@@ -157,19 +165,23 @@ let main ~mode =
   | Sys.Break ->
       MatitaLog.error "user break!";
       if mode = `COMPILER then
-        exit ~-1
+        clean_exit ~-1
       else
         pp_ocaml_mode ()
   | MatitaEngine.Drop ->
       if mode = `COMPILER then 
-        exit 1 
+        clean_exit 1 
       else 
         pp_ocaml_mode ()
   | CicTextualParser2.Parse_error (floc,err) ->
      let (x, y) = CicAst.loc_of_floc floc in
      MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err);
      if mode = `COMPILER then
-       exit 1
+       clean_exit 1
      else
        pp_ocaml_mode ()
-
+  | _ ->
+     if mode = `COMPILER then 
+       clean_exit 3
+     else 
+       pp_ocaml_mode ()