1 (* Copyright (C) 2004, 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/
26 exception Not_implemented of string
27 let not_implemented feature = raise (Not_implemented feature)
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)
34 exception No_proof (** no current proof is available *)
37 (* "observer" pattern *)
39 method update: unit -> unit
43 (* "observer" pattern *)
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
53 (* "command" pattern *)
55 method execute: unit -> unit
56 method undo: unit -> unit
59 class type parserr = (* "parser" is a keyword :-( *)
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
68 class type disambiguator =
70 method parserr: parserr
71 method setParserr: parserr -> unit
73 method env: DisambiguateTypes.environment
74 method setEnv: DisambiguateTypes.environment -> unit
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 ->
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)
93 type namer = ProofEngineTypes.mk_fresh_name_type
95 type choose_uris_callback =
96 selection_mode:Gtk.Tags.selection_mode ->
97 ?title:string -> ?msg:string -> ?nonvars_button:bool ->
101 type choose_interp_callback = (string * string) list list -> int list