]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matitaTypes.ml
snapshot
[helm.git] / helm / matita / matitaTypes.ml
1 (* Copyright (C) 2004, 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 exception Not_implemented of string
27 let not_implemented feature = raise (Not_implemented feature)
28
29   (** exceptions whose content should be presented to the user *)
30 exception Failure of string
31 let error s = raise (Failure s)
32 let warning s = prerr_endline ("MATITA WARNING: " ^ s)
33
34 exception No_proof  (** no current proof is available *)
35 exception No_choice (** no choice was made by the user *)
36
37 class type observer =
38   (* "observer" pattern *)
39   object
40     method update: unit -> unit
41   end
42
43 class subject =
44   (* "observer" pattern *)
45   object
46     val mutable observers = []
47     method attach (o: observer) = observers <- o :: observers
48     method detach (o: observer) =
49       observers <- List.filter (fun o' -> o' != o) observers
50     method notify () = List.iter (fun o -> o#update ()) observers
51   end
52
53 class type command =
54   (* "command" pattern *)
55   object
56     method execute: unit -> unit
57     method undo: unit -> unit
58   end
59
60 class type parserr =  (* "parser" is a keyword :-( *)
61   object
62     method parseTerm:     char Stream.t -> DisambiguateTypes.term
63     method parseTactic:   char Stream.t -> DisambiguateTypes.tactic
64     method parseTactical: char Stream.t -> DisambiguateTypes.tactical
65     method parseCommand:  char Stream.t -> DisambiguateTypes.command
66     method parseScript:   char Stream.t -> DisambiguateTypes.script
67   end
68
69 class type disambiguator =
70   object
71     method parserr: parserr
72     method setParserr: parserr -> unit
73
74     method disambiguateTerm:
75       context:Cic.context -> metasenv:Cic.metasenv ->
76       ?env:DisambiguateTypes.environment ->
77         char Stream.t ->
78           (DisambiguateTypes.environment * Cic.metasenv * Cic.term) list
79     method disambiguateTermAst:
80       context:Cic.context -> metasenv:Cic.metasenv ->
81       ?env:DisambiguateTypes.environment ->
82         DisambiguateTypes.term ->
83           (DisambiguateTypes.environment * Cic.metasenv * Cic.term) list
84   end
85
86 (** {2 shorthands} *)
87
88 type namer = ProofEngineTypes.mk_fresh_name_type
89
90 type choose_uris_callback =
91   selection_mode:Gtk.Tags.selection_mode ->
92   ?title:string -> ?msg:string -> ?nonvars_button:bool ->
93   string list ->
94     string list
95
96 type choose_interp_callback = (string * string) list list -> int list
97