]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/matita.ml
Ctr-C now is equivalent to pressing the Break button
[helm.git] / matita / matita / matita.ml
1 (* Copyright (C) 2004-2005, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 (* $Id$ *)
27
28 (** {2 Initialization} *)
29
30 let _ = 
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 ()
37 ;;
38
39 let _ =
40   Predefined_virtuals.load_predefined_virtuals ();
41   Predefined_virtuals.load_predefined_classes ()
42 ;;
43   
44   (** {{{ Debugging *)
45 let init_debugging_menu gui =
46   if BuildTimeConf.debug ||
47      Helm_registry.get_bool "matita.debug_menu" 
48   then begin
49     gui#main#debugMenu#misc#show ();
50     let addDebugItem label callback =
51       let item =
52         GMenu.menu_item ~packing:gui#main#debugMenu_menu#append ~label () in
53       ignore (item#connect#activate callback) 
54     in
55     let addDebugCheckbox label ?(init=false) callback =
56       let item =
57         GMenu.check_menu_item 
58           ~packing:gui#main#debugMenu_menu#append ~label () in
59       item#set_active init;
60       ignore (item#connect#toggled (callback item)) 
61     in
62     let addDebugSeparator () =
63       ignore (GMenu.separator_item ~packing:gui#main#debugMenu_menu#append ())
64     in
65     addDebugItem "dump aliases" (fun _ ->
66       let status = (MatitaScript.current ())#status in
67       GrafiteDisambiguate.dump_aliases prerr_endline "" status);
68 (* FG: DEBUGGING   
69     addDebugItem "dump interpretations" (fun _ ->
70       let status = script#lexicon_status in
71       let filter = 
72        List.filter (function LexiconAst.Interpretation _ -> true | _ -> false)
73       in
74       HLog.debug (String.concat "\n"
75        (List.fold_right
76          (fun x l -> (LexiconAstPp.pp_command x)::l)
77          (filter status.LexiconEngine.lexicon_content_rev) [])));
78 *)
79     addDebugSeparator ();
80     addDebugCheckbox "high level pretty printer" ~init:true
81       (fun mi () -> ApplyTransformation.use_high_level_pretty_printer := mi#active);
82     addDebugSeparator ();
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);
89     addDebugSeparator ();
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);
99     addDebugSeparator ();
100     addDebugItem "Expand virtuals"
101     (fun _ -> (MatitaScript.current ())#expandAllVirtuals);
102   end
103   (** Debugging }}} *)
104
105   (** {2 Main} *)
106
107 let _ =
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 ();
115   try
116    GtkThread.main ()
117   with Sys.Break -> ()
118 ;;
119
120 (* vim:set foldmethod=marker: *)