Module System
Coqtop specific system utilities
Directories
type unix_path= stringtype file_kind=|FileDir of unix_path * string|FileRegular of string
val mkdir : unix_path -> unit
val exclude_directory : unix_path -> unit
Files and load paths
val warn_cannot_open_dir : ?loc:Loc.t -> string -> unit
val all_subdirs : unix_path:string -> (CUnix.physical_path * string list) listval is_in_path : CUnix.load_path -> string -> boolval is_in_system_path : string -> boolval where_in_path : ?warn:bool -> CUnix.load_path -> string -> CUnix.physical_path * stringval find_file_in_path : ?warn:bool -> CUnix.load_path -> string -> CUnix.physical_path * stringfind_file_in_path ?warn loadpath filenamereturns the directory name and long name of the first physical occurrencefilenamein one of the directory of theloadpath; fails with a user error if no such file exists; warn if two or more files exist in the loadpath; returns instead the directory name offilenameisfilenameis an absolute path
val all_in_path : (CUnix.physical_path * 'a) list -> string -> ('a * string) listall_in_path loadpath filenamereturns the list of the directory name and full name of all physical occurrences offilenamein aloadpathbinding physical paths to some arbitrary key
I/O functions
exceptionBad_magic_number of magic_number_errorexceptionBad_version_number of magic_number_error
Time stamps.
val duration_between : start:time -> stop:time -> durationval duration_add : duration -> duration -> durationval duration_real : duration -> floatval fmt_time_difference : time -> time -> Pp.tval fmt_duration : duration -> Pp.t
type 'a transaction_result= ('a * duration, Exninfo.iexn * duration) Stdlib.Result.t
val measure_duration : ('a -> 'b) -> 'a -> 'b transaction_resultval fmt_transaction_result : 'a transaction_result -> Pp.t
Instruction count.
val instructions_between : c_start:instruction_count -> c_end:instruction_count -> instruction_countval instruction_count_add : instruction_count -> instruction_count -> instruction_count
type 'a instructions_result= ('a * instruction_count, Exninfo.iexn * instruction_count) Stdlib.Result.t
val count_instructions : ('a -> 'b) -> 'a -> 'b instructions_resultval fmt_instructions_result : 'a instructions_result -> Pp.tval get_toplevel_path : ?byte:bool -> string -> stringget_toplevel_path programbuilds a complete path to the executable denoted byprogram. This involves:- locating the directory: we don't rely on PATH as to make calls to /foo/bin/coqtop chose the right /foo/bin/coqproofworker
- adding the proper suffixes: .opt/.byte depending on the current mode, + .exe if in windows.
Note that this function doesn't check that the executable actually exists. This is left back to caller, as well as the choice of fallback strategy. We could add a fallback strategy here but it is better not to as in most cases if this function fails to construct the right name you want you execution to fail rather than fall into choosing some random binary from the system-wide installation of Coq.