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