1 (* Copyright (C) 2004-2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
30 (** {2 Initialization} *)
33 (* "-opt", Arg...., "set bla bla bla"; *)
36 sprintf "MatitaC v%s\nUsage: matitac [option ...] file ...\nOptions:"
40 Helm_registry.load_from "matita.conf.xml";
42 MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
43 MatitaDb.clean_owner_environment ();
44 MatitaDb.create_owner_environment ()
48 let add_script fname = acc := fname :: !acc in
49 Arg.parse arg_spec add_script usage;
52 let run_script fname =
53 MatitaLog.message (sprintf "execution of %s started:" fname);
58 | fname -> open_in fname)
60 let status = ref (Lazy.force MatitaEngine.initial_status) in
65 status := MatitaEngine.eval_from_stream !status is
67 | CicTextualParser2.Parse_error _ as exn ->
71 with Stream.Failure -> raise exn
73 MatitaLog.error (Printexc.to_string exn);
78 MatitaLog.message (sprintf "execution of %s completed." fname);
79 Http_getter.sync_dump_file ();
81 | CicTextualParser2.Parse_error (floc,err) ->
82 let (x, y) = CicAst.loc_of_floc floc in
83 MatitaLog.message (sprintf "Parse error at %d-%d: %s" x y err);
84 Http_getter.sync_dump_file ();
88 let _ = List.iter run_script scripts