| 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 | (** This module provides functions to load, open and save |
| 14 | libraries. Libraries correspond to the subclass of modules that |
| 15 | coincide with a file on disk (the ".vo" files). Libraries on the |
| 16 | disk comes with checksums (obtained with the [Digest] module), which |
| 17 | are checked at loading time to prevent inconsistencies between files |
| 18 | written at various dates. |
| 19 | *) |
| 20 | |
| 21 | (** Type of libraries loaded in memory *) |
| 22 | type library_t |
| 23 | |
| 24 | (** {6 ... } |
| 25 | Require = load in the environment *) |
| 26 | val require_library_from_dirpath : library_t list -> unit |
| 27 | |
| 28 | (** Intern from a .vo file located by libresolver *) |
| 29 | module Intern : sig |
| 30 | module Provenance : sig |
| 31 | type t = string * string |
| 32 | (** A pair of [kind, object], for example ["file", |
| 33 | "/usr/local/foo.vo"], used for error messages. *) |
| 34 | end |
| 35 | |
| 36 | type t = DirPath.t -> (library_t, Exninfo.iexn) Result.t * Provenance.t |
| 37 | end |
| 38 | |
| 39 | val intern_from_file : CUnix.physical_path -> |
| 40 | (library_t, Exninfo.iexn) Result.t * Intern.Provenance.t |
| 41 | |
| 42 | val require_library_syntax_from_dirpath |
| 43 | : intern:Intern.t |
| 44 | -> DirPath.t Loc.located list |
| 45 | -> library_t list |
| 46 | |
| 47 | (** {6 Start the compilation of a library } *) |
| 48 | |
| 49 | (** End the compilation of a library and save it to a ".vo" file, or a |
| 50 | ".vos" file, depending on the todo_proofs argument. |
| 51 | |
| 52 | [output_native_objects]: when producing vo objects, also compile |
| 53 | the native-code version. *) |
| 54 | |
| 55 | type 'doc todo_proofs = |
| 56 | | ProofsTodoNone (* for .vo *) |
| 57 | | ProofsTodoSomeEmpty of Future.UUIDSet.t (* for .vos *) |
| 58 | |
| 59 | val save_library_to : |
| 60 | 'document todo_proofs -> |
| 61 | output_native_objects:bool -> |
| 62 | DirPath.t -> string -> unit |
| 63 | |
| 64 | (** Save library to library_t format, that can be used later in |
| 65 | [require_library_syntax_from_dirpath] *) |
| 66 | val save_library : DirPath.t -> library_t |
| 67 | |
| 68 | (** {6 Interrogate the status of libraries } *) |
| 69 | |
| 70 | (** - Tell if a library is loaded *) |
| 71 | val library_is_loaded : DirPath.t -> bool |
| 72 | |
| 73 | (** - Tell which libraries are loaded, in the order by which they were loaded. *) |
| 74 | val loaded_libraries : unit -> DirPath.t list |
| 75 | |
| 76 | val library_compiled : DirPath.t -> Safe_typing.compiled_library |
| 77 | |
| 78 | (** {6 Native compiler. } *) |
| 79 | val native_name_from_filename : string -> string |
| 80 | |
| 81 | (** {6 Opaque accessors} *) |
| 82 | val indirect_accessor : Global.indirect_accessor |
| 83 | [@@deprecated |
| 84 | "(8.20) Most commands should not be accessing opaque data. \ |
| 85 | Use coqpp's \"opaque_access\" state specifier if you actually need it."] |