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/
28 (** {2 Initialization} *)
31 MatitaInit.add_cmdline_spec
32 ["-tptppath",Arg.String
33 (fun s -> Helm_registry.set_string "matita.tptppath" s),
34 "Where to find the Axioms/ and Problems/ directory"];
35 MatitaInit.initialize_all ();
36 MatitaMisc.reset_font_size ()
40 Predefined_virtuals.load_predefined_virtuals ();
41 Predefined_virtuals.load_predefined_classes ()
45 let init_debugging_menu gui =
46 if BuildTimeConf.debug ||
47 Helm_registry.get_bool "matita.debug_menu"
49 gui#main#debugMenu#misc#show ();
50 let addDebugItem label callback =
52 GMenu.menu_item ~packing:gui#main#debugMenu_menu#append ~label () in
53 ignore (item#connect#activate callback)
55 let addDebugCheckbox label ?(init=false) callback =
58 ~packing:gui#main#debugMenu_menu#append ~label () in
60 ignore (item#connect#toggled (callback item))
62 let addDebugSeparator () =
63 ignore (GMenu.separator_item ~packing:gui#main#debugMenu_menu#append ())
65 addDebugItem "dump aliases" (fun _ ->
66 let status = (MatitaScript.current ())#status in
67 GrafiteDisambiguate.dump_aliases prerr_endline "" status);
69 addDebugItem "dump interpretations" (fun _ ->
70 let status = script#lexicon_status in
72 List.filter (function LexiconAst.Interpretation _ -> true | _ -> false)
74 HLog.debug (String.concat "\n"
76 (fun x l -> (LexiconAstPp.pp_command x)::l)
77 (filter status.LexiconEngine.lexicon_content_rev) [])));
80 addDebugCheckbox "high level pretty printer" ~init:true
81 (fun mi () -> ApplyTransformation.use_high_level_pretty_printer := mi#active);
83 addDebugCheckbox "prune errors"
84 (fun mi () -> MatitaGui.all_disambiguation_passes := not (mi#active));
85 (*MATITA 1.0: ??? addDebugItem "prune disambiguation errors"
86 (fun _ -> MatitaGui.all_disambiguation_passes := false);*)
87 addDebugCheckbox "multiple disambiguation passes" ~init:true
88 (fun mi () -> MultiPassDisambiguator.only_one_pass := mi#active);
90 addDebugCheckbox "tactics logging"
91 (fun mi () -> NTacStatus.debug := mi#active);
92 addDebugCheckbox "disambiguation logging"
93 (fun mi () -> MultiPassDisambiguator.debug := mi#active; NCicDisambiguate.debug := mi#active);
94 addDebugCheckbox "disambiguation/refiner/unification/metasubst logging"
95 (fun mi () -> NCicRefiner.debug := mi#active; NCicUnification.debug :=
96 mi#active; MultiPassDisambiguator.debug := mi#active; NCicDisambiguate.debug := mi#active; NCicMetaSubst.debug := mi#active);
97 addDebugCheckbox "reduction logging"
98 (fun mi () -> NCicReduction.debug := mi#active);
100 addDebugItem "Expand virtuals"
101 (fun _ -> (MatitaScript.current ())#expandAllVirtuals);
108 at_exit (fun () -> print_endline "\nThanks for using Matita!\n");
109 let args = Helm_registry.get_list Helm_registry.string "matita.args" in
110 let gui = MatitaGui.instance () in
111 Sys.set_signal Sys.sigint (Sys.Signal_handle(fun _ -> gui#kill_worker ()));
112 init_debugging_menu gui;
113 List.iter gui#loadScript (List.rev args);
114 gui#main#mainWin#show ();
120 (* vim:set foldmethod=marker: *)