package frama-c
Install
Dune Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
SSylvain Chiron
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
BBenjamin Jorge
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
KKilyan Le Gallic
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
CCécile Ruet-Cros
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=a94384f00d53791cbb4b4d83ab41607bc71962d42461f02d71116c4ff6dca567
doc/frama-c.kernel/Frama_c_kernel/Filepath/index.html
Module Frama_c_kernel.Filepath
Functions manipulating normalized filepaths. In these functions, references *he current working directory refer to the result given by function Sys.getcwd.
Basic datatype functions
Filepath.t
is a Frama-C datatype, and comes with usual compare
, equal
, hash
and pretty
functions.
Pretty-print is done according to these rules:
- relative filenames are kept, except for leading './', which are stripped;
- absolute filenames are relativized if their prefix is included in the current working directory; also, symbolic names are resolved, i.e. the result may be prefixed by known aliases (e.g. FRAMAC_SHARE). See
add_symbolic_dir
for more details. Therefore, the result of this function may not designate a valid name in the filesystem and must ONLY be used to pretty-print information; it must NEVER to be converted back to a filepath later on.
include Datatype.S_with_collections with type t := t
include Datatype.S with type t := t
include Datatype.S_no_copy with type t := t
include Datatype.Ty with type t := t
val packed_descr : Structural_descr.pack
Packed version of the descriptor.
val reprs : t list
List of representants of the descriptor.
val hash : t -> int
Hash function: same spec than Hashtbl.hash
.
val pretty : Stdlib.Format.formatter -> t -> unit
Pretty print each value in an user-friendly way.
val mem_project : (Project_skeleton.t -> bool) -> t -> bool
mem_project f x
must return true
iff there is a value p
of type Project.t
in x
such that f p
returns true
.
module Set : Datatype.Set with type elt = t
module Map : Datatype.Map with type key = t
module Hashtbl : Datatype.Hashtbl with type key = t
Compares prettified (i.e. relative) paths, with or without case sensitivity (by default, case_sensitive = false
).
val pretty_abs : Stdlib.Format.formatter -> t -> unit
Pretty-prints the path (absolute)
val pretty_rel : Stdlib.Format.formatter -> t -> unit
Pretty-prints the path (relative to current working dir)
Constant paths
val empty : t
Empty filepath.
val is_empty : t -> bool
val is_special_stdout : t -> bool
is_special_stdout f
returns true
iff f
is '-' (a single dash), which is a special notation for 'stdout'.
Path manipulation
Returns an absolute path leading to the given file. The result is similar to realpath --no-symlinks
. Some special behaviors include:
normalize ""
(empty string) returns "" (realpath returns an error);normalize
preserves multiple sequential '/' characters, unlikerealpath
;- non-existing directories in
realpath
may lead to ENOTDIR errors, butnormalize
may accept them.
val to_string : t -> string
to_string p
returns p
prettified, that is, a relative path-like string. Note that this prettified string may contain symbolic dirs and is thus is not a path.
to_string_rel ?quoted p
returns p
relativized if it is relative, or returns the absolute path otherwise.
val to_string_abs : ?quoted:bool -> t -> string
to_string_rel p
returns p
absolutized.
val to_string_list : t list -> string list
to_string_list l
returns l
as a list of strings containing the absolute paths to the elements of l
.
val to_base_uri : t -> Hpath.base * string
to_base_uri path
returns a pair base, rest
, according to the prettified value of path
:
- if it starts with symbolic path SYMB, prefix is Hpath.Name "SYMB";
- if it is a relative path, prefix is Hpath.Cwd;
- else (an absolute path), prefix is Hpath.Absolute.
rest
contains everything after the '/' following the prefix. E.g. for the path "FRAMAC_SHARE/libc/string.h", returns (Name "FRAMAC_SHARE", "libc/string.h").
val basename : t -> string
Equivalent to Filename.basename
.
extend ~existence file ext
returns the normalized path to the file file
^ ext
. Note that it does not introduce a dot. The resulting path must respect existence
.
concat ~existence dir file
returns the normalized path resulting from the concatenation of dir
^ "/" ^ file
. The resulting path must respect existence
.
Operator version of Filepath.concat
. Filepath.(file / ext)
is equivalent to Filepath.concat file ext
.
concats ~existence dir paths
concatenates a list of paths, as per the concat
function.
val has_suffix : t -> string -> bool
Same as Filename.check_suffix
.
Current working directory
val pwd : unit -> t
Symboling Names
val add_symbolic_dir : string -> t -> unit
add_symbolic_dir name dir
indicates that the (absolute) path dir
must be replaced by name
when pretty-printing paths. This alias ensures that system-dependent paths such as FRAMAC_SHARE are printed identically in different machines.
val add_symbolic_dir_list : string -> t list -> unit
val remove_symbolic_dir : t -> unit
Remove all symbolic dirs that have been added earlier.
val all_symbolic_dirs : unit -> (string * t) list
Returns the list of symbolic dirs added via add_symbolic_dir
, plus preexisting ones (e.g. FRAMAC_SHARE), as pairs (name, dir).
Position in source file
Describes a position in a source file.
val empty_pos : position
Empty position, used as 'dummy' for Cil_datatype.Position
.
val pp_pos : Stdlib.Format.formatter -> position -> unit
Pretty-prints a position, in the format file:line.
val is_empty_pos : position -> bool
Return true if the given position is the empty position.
Deprecated functions
val normalize : ?existence:existence -> ?base_name:string -> string -> string
val exists : t -> bool
val is_file : t -> bool
val is_dir : t -> bool
val readdir : t -> string array
val remove : t -> unit
val iter_lines : t -> (string -> unit) -> unit
module Normalized : sig ... end