+ (* cleanup of previously compiled objects *)
+ if (not (Http_getter_storage.is_empty ~local:true baseuri) ||
+ LibraryClean.db_uris_of_baseuri baseuri <> [])
+ then begin
+ HLog.message ("baseuri " ^ baseuri ^ " is not empty");
+ HLog.message ("cleaning baseuri " ^ baseuri);
+ LibraryClean.clean_baseuris [baseuri];
+ end;
+ HLog.message ("compiling " ^ Filename.basename fname ^ " in " ^ baseuri);
+ if not (Helm_registry.get_bool "matita.verbose") then
+ (let cc =
+ let rex = Str.regexp ".*opt$" in
+ if Str.string_match rex Sys.argv.(0) 0 then "matitac.opt"
+ else "matitac"
+ in
+ let s = Printf.sprintf "%s %-35s " cc (cut (root^"/") fname) in
+ print_string s; flush stdout);
+ (* we dalay this error check until we print 'matitac file ' *)
+ assert (Http_getter_storage.is_empty ~local:true baseuri);
+ (* create dir for XML files *)
+ if not (Helm_registry.get_opt_default Helm_registry.bool "matita.nodisk"
+ ~default:false)
+ then
+ HExtlib.mkdir
+ (Filename.dirname
+ (Http_getter.filename ~local:true ~writable:true (baseuri ^
+ "foo.con")));
+ let buf = Ulexing.from_utf8_channel (open_in fname) in
+ let print_cb =
+ if not (Helm_registry.get_bool "matita.verbose") then (fun _ _ -> ())
+ else pp_ast_statement
+ in
+ let grafite_status, lexicon_status =
+ let rec aux_for_dump x =
+ try
+ match
+ MatitaEngine.eval_from_stream ~first_statement_only:false ~include_paths
+ lexicon_status grafite_status buf x
+ with
+ | [] -> grafite_status, lexicon_status
+ | ((grafite,lexicon),None)::_ -> grafite, lexicon
+ | ((_,l),Some _)::_ -> raise (AttemptToInsertAnAlias l)
+
+ with MatitaEngine.EnrichedWithLexiconStatus
+ (GrafiteEngine.Macro (floc, f), lex_status) as exn ->
+ match f (get_macro_context (Some grafite_status)) with
+ | _, GrafiteAst.Inline (_, style, suri, prefix) ->
+ let str =
+ ApplyTransformation.txt_of_inline_macro style suri prefix
+ ~map_unicode_to_tex:(Helm_registry.get_bool
+ "matita.paste_unicode_as_tex") in
+ !out str;
+ aux_for_dump x
+ |_-> raise exn
+ in
+ aux_for_dump print_cb
+ in
+ let elapsed = Unix.time () -. time in
+ let proof_status,moo_content_rev,lexicon_content_rev =
+ grafite_status.proof_status, grafite_status.moo_content_rev,
+ lexicon_status.LexiconEngine.lexicon_content_rev