X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=helm%2Fmatita%2Fmatitac.ml;h=e7cdef9f4afb898ac82d492b58dab4a03a108965;hb=cb7af66937e8c72ae6ea6694350a0c86f3e6ccf9;hp=ef0ab5a99ccf6fcbb170294ad0b0343e9add02a4;hpb=e6708c10ad615233628900902101216cc2f5baf5;p=helm.git diff --git a/helm/matita/matitac.ml b/helm/matita/matitac.ml index ef0ab5a99..e7cdef9f4 100644 --- a/helm/matita/matitac.ml +++ b/helm/matita/matitac.ml @@ -71,11 +71,12 @@ let run_script fname = MatitaLog.debug ("Executing: ``" ^ stm ^ "''") in try - status := MatitaEngine.eval_from_stream !status is cb + status := MatitaEngine.eval_from_stream !status is cb ; + !status with | CicTextualParser2.Parse_error (floc,err) -> let (x, y) = CicAst.loc_of_floc floc in - MatitaLog.message (sprintf "Parse error at %d-%d: %s" x y err); + MatitaLog.error (sprintf "Parse error at %d-%d: %s" x y err); Http_getter.sync_dump_file (); exit 1 | exn -> @@ -83,10 +84,17 @@ let run_script fname = raise exn let _ = - List.iter (fun fname -> + at_exit + (fun () -> + Http_getter_logger.log "Sync map tree to disk..."; + Http_getter.sync_dump_file (); + print_endline "\nThanks for using Matita!\n"); + Sys.catch_break true; + try + List.iter (fun fname -> let time = Unix.time () in MatitaLog.message (sprintf "execution of %s started:" fname); - run_script fname; + let status = run_script fname in let elapsed = Unix.time () -. time in let tm = Unix.gmtime elapsed in let sec = @@ -98,9 +106,20 @@ let _ = let hou = if tm.Unix.tm_hour > 0 then (string_of_int tm.Unix.tm_hour ^ "h ") else "" in - MatitaLog.message - (sprintf "execution of %s completed in %s." fname (hou^min^sec))) scripts; - Http_getter.sync_dump_file (); - exit(0) - - + let proof_status = status.proof_status in + if proof_status <> MatitaTypes.No_proof then + begin + MatitaLog.error + "there are still incomplete proofs at the end of the script"; + exit(-1) + end + else + begin + MatitaLog.message + (sprintf "execution of %s completed in %s." fname (hou^min^sec)) ; + exit(0) + end + ) scripts + with Sys.Break -> + MatitaLog.error "user break!"; + exit (-1)