]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matitaMisc.mli
added get_proof_conclusione and list_tl_at
[helm.git] / helm / matita / matitaMisc.mli
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 val baseuri_of_file : string -> string 
27
28 val baseuri_of_baseuri_decl : ('a, 'b, 'c) GrafiteAst.statement -> string option
29
30   (** check whether no objects are defined below a given baseuri *)
31 val is_empty: string -> bool
32
33 (** removes a file if it exists *)
34 val safe_remove: string -> unit
35
36 val is_dir: string -> bool  (** @return true if file is a directory *)
37 val is_regular: string -> bool  (** @return true if file is a regular file *)
38
39 val input_file: string -> string  (** read all the contents of file to string *)
40 val output_file: string -> string -> unit  (** write string to file *)
41
42 val absolute_path: string -> string 
43
44   (** @return true if file is a (textual) proof script *)
45 val is_proof_script: string -> bool
46
47   (** @return true if file is a (binary) proof object *)
48 val is_proof_object: string -> bool
49
50   (** given a phrase, if it doesn't end with BuildTimeConf.phrase_sep, append
51   * it *)
52 val append_phrase_sep: string -> string
53
54 val strip_trailing_blanks: string -> string
55 val strip_trailing_slash: string -> string
56
57   (* split a string at character, char defaults to ' ' *)
58 val split: ?char:char -> string -> string list
59
60 val list_uniq: 'a list -> 'a list (* uniq unix filter on lists *)
61
62   (** @return tl tail of a list starting at a given element
63    * @param eq equality to be used, defaults to physical equality (==)
64    * @raise Not_found *)
65 val list_tl_at: ?equality:('a -> 'a -> bool) -> 'a -> 'a list -> 'a list
66
67   (** @raise Failure *)
68 val unopt: 'a option -> 'a
69
70   (** Gdome.element of a MathML document whose rendering should be blank. Used
71   * by cicBrowser to render "about:blank" document *)
72 val empty_mathml: unit -> Gdome.document
73 val empty_boxml: unit -> Gdome.document
74
75 exception History_failure
76
77 type 'a memento
78
79 class type ['a] history =
80   object ('b)
81     method add : 'a -> unit
82     method next : 'a        (** @raise History_failure *)
83     method previous : 'a    (** @raise History_failure *)
84     method load: 'a memento -> unit
85     method save: 'a memento
86     method is_begin: bool 
87     method is_end: bool 
88   end
89
90   (** shell like history: new items added at the end of the history
91   * @param size maximum history size *)
92 class shell_history : int -> [string] history
93
94   (** browser like history: new items added at the current point of the history
95   * @param size maximum history size
96   * @param first element in history (this history is never empty) *)
97 class ['a] browser_history: ?memento:'a memento -> int -> 'a -> ['a] history
98
99   (** create a singleton from a given function. Given function is invoked the
100   * first time it gets called. Next invocation will return first value *)
101 val singleton: (unit -> 'a) -> (unit -> 'a)
102
103   (** create a directory, building also parents if needed
104   * @raise Failure when unable to create some directory *)
105 val mkdir: string -> unit
106
107 val qualify: MatitaTypes.status -> string -> string
108
109 val get_proof_status: MatitaTypes.status -> ProofEngineTypes.status
110 val get_proof_metasenv: MatitaTypes.status ->  Cic.metasenv
111 val get_proof_context: MatitaTypes.status -> Cic.context 
112 val get_proof_conclusion: MatitaTypes.status -> Cic.term 
113 val get_proof_aliases: MatitaTypes.status -> DisambiguateTypes.environment 
114
115   (** given the base name of an image, returns its full path *)
116 val image_path: string -> string
117 val obj_file_of_baseuri: string -> string
118 val obj_file_of_script: string -> string
119
120   (** invoke a given function and return its value; in addition il will print
121    * the given string before invoking it and "/" ^ the given string afterwards.
122    * This permit tracing of functions which does not return a value *)
123 val debug_wrap: string -> (unit -> 'a) -> 'a
124