Module Extlib


module Extlib: sig .. end
Useful operations.

This module does not depend of any of frama-c module.
Consult the Plugin Development Guide for additional details.


val nop : 'a -> unit
Do nothing.
val find_or_none : ('a -> 'b) -> 'a -> 'b option
val adapt_filename : string -> string
Ensure that the given filename has the extension "cmo" in bytecode and "cmxs" in native
val max_cpt : int -> int -> int

Function builders


exception NotYetImplemented of string
Consult the Plugin Development Guide for additional details.
val not_yet_implemented : string -> 'a
Raises NotYetImplemented with the given string.
val mk_fun : string -> ('a -> 'b) Pervasives.ref
Deprecated.since Beryllium-20090601-beta1+dev
build a reference to an unitialized function (which raises NotYetImplemented if it is called).
val deprecated : string -> now:string -> ('a -> 'b) -> 'a -> 'b
Deprecated.since Beryllium-20090601-beta1+dev
deprecated s ~now f indicates that the use of f of name s is now deprecated. It should be replaced by now.
Since Lithium-20081201
Returns the given function itself

Function combinators


val ($) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
Composition.
val swap : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
Swap arguments.

Lists


val as_singleton : 'a list -> 'a
returns the unique element of a singleton list.
Raises Invalid_argument on a non singleton list.
val filter_out : ('a -> bool) -> 'a list -> 'a list
Filter out elements that pass the test
val product : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
product f l1 l2 applies f to all the pairs of an elt of l1 and an element of l2.

Options


val may : ('a -> unit) -> 'a option -> unit
val may_map : ('a -> 'b) -> ?dft:'b -> 'a option -> 'b
may_map f ?dft x applies f to the value of x if exists. Otherwise returns the default value dft. Assume that either x or dft is defined.
val opt_map : ('a -> 'b) -> 'a option -> 'b option
val opt_filter : ('a -> bool) -> 'a option -> 'a option
val the : 'a option -> 'a
Raises Invalid_argument if the value is none.
Consult the Plugin Development Guide for additional details.
val getperfcount : unit -> int
val getperfcount1024 : unit -> int
val address_of_value : 'a -> int

Exception catcher


val try_finally : finally:(unit -> unit) -> ('a -> 'b) -> 'a -> 'b

Launching an external process


val full_command : string ->
string array ->
stdin:Unix.file_descr ->
stdout:Unix.file_descr -> stderr:Unix.file_descr -> int
Same arguments as but returns only when execution is complete. It returns the exit code of the executed process.