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 *)
35 exception No_choice (** no choice was made by the user *)
38 (* "observer" pattern *)
40 method update: unit -> unit
44 (* "observer" pattern *)
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
54 (* "command" pattern *)
56 method execute: unit -> unit
57 method undo: unit -> unit
60 class type parserr = (* "parser" is a keyword :-( *)
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
69 class type disambiguator =
71 method parserr: parserr
72 method setParserr: parserr -> unit
74 method disambiguateTerm:
75 context:Cic.context -> metasenv:Cic.metasenv ->
76 ?env:DisambiguateTypes.environment ->
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
88 type namer = ProofEngineTypes.mk_fresh_name_type
90 type choose_uris_callback =
91 selection_mode:Gtk.Tags.selection_mode ->
92 ?title:string -> ?msg:string -> ?nonvars_button:bool ->
96 type choose_interp_callback = (string * string) list list -> int list