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