Debian Codegraph @

vernac/loadpath.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Names
12
13 (** * Load paths.
14
15 A load path is a physical path in the file system; to each load path is
16 associated a Rocq [DirPath.t] (the "logical" path of the physical path).
17
18 *)
19
20 type t
21 (** Type of loadpath bindings. *)
22
23 val logical : t -> DirPath.t
24 (** Get the logical path (Rocq module hierarchy) of a loadpath. *)
25
26 val physical : t -> CUnix.physical_path
27 (** Get the physical path of a loadpath *)
28
29 val pp : t -> Pp.t
30 (** Print a load path *)
31
32 val get_load_paths : unit -> t list
33 (** Get the current loadpath association. *)
34
35 val remove_load_path : CUnix.physical_path -> unit
36 (** Remove the current logical path binding associated to a given physical path,
37 if any. *)
38
39 val find_load_path : CUnix.physical_path -> t
40 (** Get the binding associated with a physical path. Raises [Not_found] if there
41 is none. *)
42
43 val find_with_logical_path : Names.DirPath.t -> t list
44 (** get the list of load paths that correspond to a given logical path *)
45
46 val find_extra_dep_with_logical_path :
47 ?loc:Loc.t -> from:Names.DirPath.t -> file:string -> unit -> CUnix.physical_path
48 (** finds a file rooted in from. @raise UserError if the file is not found *)
49
50 val locate_file : string -> string
51 (** Locate a file among the registered paths. Do not use this function, as
52 it does not respect the visibility of paths. *)
53
54 (** {6 Locate a library in the load path } *)
55 module Error : sig
56 type t = LibUnmappedDir | LibNotFound
57
58 (** Raise regular Rocq errors with default informative message;
59 usually document managers that have more information about the
60 workspace than rocq compile will override this with a better
61 mechanism / message. *)
62 val raise : DirPath.t -> t -> 'a
63 end
64
65 val locate_qualified_library
66 : ?root:DirPath.t
67 -> Libnames.qualid
68 -> (DirPath.t * CUnix.physical_path, Error.t) Result.t
69
70 (** Locates a library by implicit name.
71
72 @return LibUnmappedDir if the library is not in the path
73 @return LibNotFound if there is no corresponding file in the path
74
75 *)
76 val locate_absolute_library : DirPath.t -> (CUnix.physical_path, Error.t) Result.t
77
78 (** {6 Extending the Load Path } *)
79
80 (** Adds a path to the Rocq and ML paths *)
81 type vo_path =
82 { unix_path : string
83 (** Filesystem path containing vo/ml files *)
84 ; coq_path : DirPath.t
85 (** Rocq prefix for the path *)
86 ; implicit : bool
87 (** [implicit = true] avoids having to qualify with [coq_path]
88 true for -R, false for -Q in command line *)
89 ; recursive : bool
90 (** [recursive] will determine whether we explore sub-directories *)
91 ; installed : bool
92 (** [installed] is true for automatically added paths (eg
93 user-contrib), which are assumed to be installed files.
94 False is assumed to be local files (ie current development). *)
95 }
96
97 val add_vo_path : vo_path -> unit
98
99 (** Flag to indicate that .vos files should be loaded for dependencies
100 instead of .vo files. Used by -vos and -vok options. *)
101 val load_vos_libraries : bool ref