package frama-c

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The Normalized module is simply a wrapper that ensures that paths are always normalized. Used by Datatype.Filepath.

  • since 18.0-Argon
type t = private string

The normalized (absolute) path.

val of_string : ?existence:existence -> ?base_name:string -> string -> t

of_string s converts s into a normalized path.

  • raises Invalid_argument

    if s is the empty string.

  • before 21.0-Scandium

    no existence argument.

val extend : ?existence:existence -> t -> string -> t

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.

  • since 29.0-Copper
val concat : ?existence:existence -> t -> string -> t

concat ~existence dir file returns the normalized path resulting from the concatenation of dir ^ "/" ^ file. The resulting path must respect existence.

  • since 22.0-Titanium
val concats : ?existence:existence -> t -> string list -> t

concats ~existence dir paths concatenates a list of paths, as per the concat function.

  • since 28.0-Nickel
val to_pretty_string : t -> string

to_pretty_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. See pretty for details about usage.

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.

  • since 23.0-Vanadium
val equal : t -> t -> bool
val compare : t -> t -> int

Compares normalized paths

val compare_pretty : ?case_sensitive:bool -> t -> t -> int

Compares prettified (i.e. relative) paths, with or without case sensitivity (by default, case_sensitive = false).

val pretty : Stdlib.Format.formatter -> t -> unit

Pretty-print a path 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.
val pp_abs : Stdlib.Format.formatter -> t -> unit

Pretty-prints the normalized (absolute) path.

val unknown : t

Unknown filepath, used as 'dummy' for Datatype.Filepath.

  • deprecated

    23.0-Vanadium use 'empty' instead

val is_unknown : t -> bool
  • since 20.0-Calcium
  • deprecated

    23.0-Vanadium use 'is_empty' instead

val empty : t

Empty filepath, used as 'dummy' for Datatype.Filepath.

  • since 23.0-Vanadium.
val is_empty : t -> bool
  • since 23.0-Vanadium
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'.

  • since 23.0-Vanadium
val is_file : t -> bool

is_file f returns true iff f points to a regular file (or a symbolic link pointing to a file). Returns false if any errors happen when stat'ing the file.

  • since 22.0-Titanium
val to_base_uri : t -> string option * string

to_base_uri path returns a pair prefix, rest, according to the prettified value of path:

  • if it starts with symbolic path SYMB, prefix is Some "SYMB";
  • if it is a relative path, prefix is Some "PWD";
  • else (an absolute path), prefix is None. rest contains everything after the '/' following the prefix. E.g. for the path "FRAMAC_SHARE/libc/string.h", returns ("FRAMAC_SHARE", "libc/string.h").
  • since 22.0-Titanium
OCaml

Innovation. Community. Security.