]> 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
36 class type observer =
37   (* "observer" pattern *)
38   object
39     method update: unit -> unit
40   end
41
42 class subject =
43   (* "observer" pattern *)
44   object
45     val mutable observers = []
46     method attach (o: observer) = observers <- o :: observers
47     method detach (o: observer) =
48       observers <- List.filter (fun o' -> o' != o) observers
49     method notify () = List.iter (fun o -> o#update ()) observers
50   end
51
52 class type command =
53   (* "command" pattern *)
54   object
55     method execute: unit -> unit
56     method undo: unit -> unit
57   end
58
59 class type parserr =  (* "parser" is a keyword :-( *)
60   object
61     method parseTerm:     char Stream.t -> DisambiguateTypes.term
62     method parseTactic:   char Stream.t -> DisambiguateTypes.tactic
63     method parseTactical: char Stream.t -> DisambiguateTypes.tactical
64     method parseCommand:  char Stream.t -> DisambiguateTypes.command
65     method parseScript:   char Stream.t -> DisambiguateTypes.script
66   end
67
68 class type disambiguator =
69   object
70     method parserr: parserr
71     method setParserr: parserr -> unit
72
73     method env: DisambiguateTypes.environment
74     method setEnv: DisambiguateTypes.environment -> unit
75
76       (* TODO Zack: as long as matita doesn't support MDI inteface,
77       * disambiguateTerm will return a single term *)
78       (** @param env defaults to self#env *)
79     method disambiguateTerm:
80       ?context:Cic.context -> ?metasenv:Cic.metasenv ->
81       ?env:DisambiguateTypes.environment ->
82         char Stream.t ->
83           (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
84     method disambiguateTermAst:
85       ?context:Cic.context -> ?metasenv:Cic.metasenv ->
86       ?env:DisambiguateTypes.environment ->
87         DisambiguateTypes.term ->
88           (DisambiguateTypes.environment * Cic.metasenv * Cic.term)
89   end
90
91 (** {2 shorthands} *)
92
93 type namer = ProofEngineTypes.mk_fresh_name_type
94
95 type choose_uris_callback =
96   selection_mode:Gtk.Tags.selection_mode ->
97   ?title:string -> ?msg:string -> ?nonvars_button:bool ->
98   string list ->
99     string list
100
101 type choose_interp_callback = (string * string) list list -> int list
102