]> matita.cs.unibo.it Git - helm.git/blob - matitaB/matita/matita.ml
update in basic_2
[helm.git] / matitaB / 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 open Printf
29
30 open MatitaGtkMisc
31 open GrafiteTypes
32
33 (** {2 Initialization} *)
34
35 let _ = 
36   MatitaInit.add_cmdline_spec
37     ["-tptppath",Arg.String 
38       (fun s -> Helm_registry.set_string "matita.tptppath" s),
39       "Where to find the Axioms/ and Problems/ directory"];
40   MatitaInit.initialize_all ()
41 ;;
42
43 let _ =
44   Predefined_virtuals.load_predefined_virtuals ();
45   Predefined_virtuals.load_predefined_classes ()
46 ;;
47   
48   (** {{{ Debugging *)
49 let init_debugging_menu gui =
50   if BuildTimeConf.debug ||
51      Helm_registry.get_bool "matita.debug_menu" 
52   then begin
53     gui#main#debugMenu#misc#show ();
54     let addDebugItem label callback =
55       let item =
56         GMenu.menu_item ~packing:gui#main#debugMenu_menu#append ~label () in
57       ignore (item#connect#activate callback) 
58     in
59     let addDebugCheckbox label ?(init=false) callback =
60       let item =
61         GMenu.check_menu_item 
62           ~packing:gui#main#debugMenu_menu#append ~label () in
63       item#set_active init;
64       ignore (item#connect#toggled (callback item)) 
65     in
66     let addDebugSeparator () =
67       ignore (GMenu.separator_item ~packing:gui#main#debugMenu_menu#append ())
68     in
69     addDebugItem "dump aliases" (fun _ ->
70       let status = (MatitaScript.current ())#status in
71       GrafiteDisambiguate.dump_aliases prerr_endline "" status);
72 (* FG: DEBUGGING   
73     addDebugItem "dump interpretations" (fun _ ->
74       let status = script#lexicon_status in
75       let filter = 
76        List.filter (function LexiconAst.Interpretation _ -> true | _ -> false)
77       in
78       HLog.debug (String.concat "\n"
79        (List.fold_right
80          (fun x l -> (LexiconAstPp.pp_command x)::l)
81          (filter status.LexiconEngine.lexicon_content_rev) [])));
82 *)
83     addDebugSeparator ();
84     addDebugCheckbox "high level pretty printer" ~init:true
85       (fun mi () -> ApplyTransformation.use_high_level_pretty_printer := mi#active);
86     addDebugSeparator ();
87     addDebugCheckbox "prune errors"
88       (fun mi () -> MatitaGui.all_disambiguation_passes := not (mi#active));
89     (*MATITA 1.0: ??? addDebugItem "prune disambiguation errors"
90       (fun _ -> MatitaGui.all_disambiguation_passes := false);*)
91     addDebugCheckbox "multiple disambiguation passes" ~init:true
92       (fun mi () -> MultiPassDisambiguator.only_one_pass := mi#active);
93     addDebugSeparator ();
94     addDebugCheckbox "tactics logging" 
95       (fun mi () -> NTacStatus.debug := mi#active);
96     addDebugCheckbox "disambiguation/refiner/unification/metasubst logging"
97       (fun mi () -> NCicRefiner.debug := mi#active; NCicUnification.debug :=
98               mi#active; MultiPassDisambiguator.debug := mi#active; NCicMetaSubst.debug := mi#active);
99     addDebugCheckbox "reduction logging"
100       (fun mi () -> NCicReduction.debug := mi#active);
101     addDebugSeparator ();
102     addDebugItem "Expand virtuals"
103     (fun _ -> (MatitaScript.current ())#expandAllVirtuals);
104   end
105   (** Debugging }}} *)
106
107   (** {2 Main} *)
108
109 let _ =
110   at_exit (fun () -> print_endline "\nThanks for using Matita!\n");
111   Sys.catch_break true;
112   let args = Helm_registry.get_list Helm_registry.string "matita.args" in
113   let gui = MatitaGui.instance () in
114   init_debugging_menu gui;
115   List.iter gui#loadScript (List.rev args);
116   gui#main#mainWin#show ();
117   try
118    GtkThread.main ()
119   with Sys.Break -> ()
120 ;;
121
122 (* vim:set foldmethod=marker: *)