]> matita.cs.unibo.it Git - helm.git/blob - components/library/librarian.mli
matita 0.5.1 tagged
[helm.git] / components / library / librarian.mli
1 (* Copyright (C) 2004-2008, 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 exception NoRootFor of string
27
28 (* make a relative path absolute *)
29 val absolutize: string -> string 
30
31 (* a root file is a text, line oriented, file containing pairs separated by
32  * the '=' character. Example:
33  *
34  *  baseuri = cic:/foo/bar
35  *  include_paths = ../baz ../../pippo
36  *
37  * spaces at the end/begin of the line and around '=' are ignored,
38  * multiple spaces in the middle of an item are shrinked to one.
39  *)
40 val load_root_file: string -> (string*string) list
41
42 (* baseuri_of_script ?(inc:REG[matita.includes]) fname 
43  *   -> 
44  * root, buri, fullpath, rootrelativepath
45  * sample: baseuri_of_script a.ma -> /home/pippo/devel/, cic:/matita/a,
46  * /home/pippo/devel/a.ma, a.ma *)
47 val baseuri_of_script: 
48   include_paths:string list -> string -> string * string * string * string
49
50 (* given a baseuri and a file name (relative to its root)
51  * returns a baseuri:
52  *    mk_baseuri "cic:/matita" "nat/plus.ma" -> "cic:/matita/nat/plus"
53  *)    
54 val mk_baseuri: string -> string -> string
55
56 (* finds all the roots files in the specified dir, roots are
57  * text files, readable by the user named 'root'
58  *)
59 val find_roots_in_dir: string -> string list
60
61 (* make implementation *)
62 type options = (string * string) list
63
64 module type Format =
65   sig
66     type source_object
67     type target_object
68     val load_deps_file: string -> (source_object * source_object list) list
69     val string_of_source_object: source_object -> string
70     val string_of_target_object: target_object -> string
71     val build: options -> source_object -> bool
72     val root_and_target_of: 
73           options -> source_object -> string option * target_object
74     val mtime_of_source_object: source_object -> float option
75     val mtime_of_target_object: target_object -> float option
76     val is_readonly_buri_of: options -> source_object -> bool
77   end
78
79 module Make :
80   functor (F : Format) ->
81     sig
82       (* make [root dir] [targets], targets = [] means make all *)
83       val make : string -> F.source_object list ->  bool
84     end
85
86 (* deps are made with scripts names, for example lines like
87  *
88  *   nat/plus.ma nat/nat.ma logic/equality.ma
89  *
90  * state that plus.ma needs nat and equality
91  *)
92 val load_deps_file: string -> (string * string list) list
93 val write_deps_file: string option -> (string * string list) list -> unit
94
95 (* FG ***********************************************************************)
96
97 (* true if the argunent starts with a uri scheme prefix *)
98 val is_uri: string -> bool