blob: fe4dc55c219ea4c1b72d48e20f74707265b5552e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
open Names
(** * Load paths.
A load path is a physical path in the file system; to each load path is
associated a Coq [DirPath.t] (the "logical" path of the physical path).
*)
type t
(** Type of loadpath bindings. *)
val physical : t -> CUnix.physical_path
(** Get the physical path (filesystem location) of a loadpath. *)
val logical : t -> DirPath.t
(** Get the logical path (Coq module hierarchy) of a loadpath. *)
val get_load_paths : unit -> t list
(** Get the current loadpath association. *)
val add_load_path : CUnix.physical_path -> DirPath.t -> implicit:bool -> unit
(** [add_load_path phys log type] adds the binding [phys := log] to the current
loadpaths. *)
val remove_load_path : CUnix.physical_path -> unit
(** Remove the current logical path binding associated to a given physical path,
if any. *)
val find_load_path : CUnix.physical_path -> t
(** Get the binding associated to a physical path. Raises [Not_found] if there
is none. *)
val is_in_load_paths : CUnix.physical_path -> bool
(** Whether a physical path is currently bound. *)
val expand_path : ?root:DirPath.t -> DirPath.t -> (CUnix.physical_path * DirPath.t) list
(** Given a relative logical path, associate the list of absolute physical and
logical paths which are possible matches of it. *)
val filter_path : (DirPath.t -> bool) -> (CUnix.physical_path * DirPath.t) list
(** As {!expand_path} but uses a filter function instead, and ignores the
implicit status of loadpaths. *)
val locate_file : string -> string
(** Locate a file among the registered paths. Do not use this function, as
it does not respect the visibility of paths. *)
(** {6 Locate a library in the load path } *)
exception LibUnmappedDir
exception LibNotFound
type library_location = LibLoaded | LibInPath
val locate_qualified_library :
?root:DirPath.t -> ?warn:bool -> Libnames.qualid ->
library_location * DirPath.t * CUnix.physical_path
(** Locates a library by implicit name.
@raise LibUnmappedDir if the library is not in the path
@raise LibNotFound if there is no corresponding file in the path
*)
val try_locate_absolute_library : DirPath.t -> string
(** {6 Extending the Load Path } *)
(** Adds a path to the Coq and ML paths *)
type add_ml = AddNoML | AddTopML | AddRecML
type vo_path_spec = {
unix_path : string;
(** Filesystem path contaning vo/ml files *)
coq_path : Names.DirPath.t;
(** Coq prefix for the path *)
implicit : bool;
(** [implicit = true] avoids having to qualify with [coq_path] *)
has_ml : add_ml;
(** If [has_ml] is true, the directory will also be search for plugins *)
}
type coq_path_spec =
| VoPath of vo_path_spec
| MlPath of string
type coq_path = {
path_spec: coq_path_spec;
recursive: bool;
}
val add_coq_path : coq_path -> unit
|