module Cilutil: sig
.. end
Deprecated.the whole module should migrate to Extlib
A bunch of generally useful functions.
Consult the Plugin Development Guide for additional details.
val docHash : ?sep:Pretty_utils.sformat ->
('a, 'b) Pretty_utils.formatter2 -> ('a, 'b) Hashtbl.t Pretty_utils.formatter
val hash_to_list : ('a, 'b) Hashtbl.t -> ('a * 'b) list
val keys : ('a, 'b) Hashtbl.t -> 'a list
val ($) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
composition of functions
val swap : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
swap f x y
is f y x
val hash_copy_into : ('a, 'b) Hashtbl.t -> ('a, 'b) Hashtbl.t -> unit
Copy a hash table into another
val list_drop : int -> 'a list -> 'a list
val list_droptail : int -> 'a list -> 'a list
val list_span : ('a -> bool) -> 'a list -> 'a list * 'a list
val list_insert_by : ('a -> 'a -> int) -> 'a -> 'a list -> 'a list
val list_head_default : 'a -> 'a list -> 'a
val list_iter3 : ('a -> 'b -> 'c -> unit) -> 'a list -> 'b list -> 'c list -> unit
val get_some_option_list : 'a option list -> 'a list
val list_append : 'a list -> 'a list -> 'a list
val list_iteri : (int -> 'a -> unit) -> 'a list -> unit
Iterate over a list passing the index as you go
val list_mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val list_fold_lefti : ('a -> int -> 'b -> 'a) -> 'a -> 'b list -> 'a
Like fold_left but pass the index into the list as well
val int_range_list : int -> int -> int list
Generates the range of integers starting with a and ending with b
val list_init : int -> (int -> 'a) -> 'a list
val list_find_first : 'a list -> ('a -> 'b option) -> 'b option
Find the first element in a list that returns Some
val list_last : 'a list -> 'a
Returns the last element of a list; O(N), tail recursive.
Raises Invalid_argument
on an empty list.
mapNoCopy is like map but avoid copying the list if the function does not
change the elements
val mapNoCopy : ('a -> 'a) -> 'a list -> 'a list
val mapNoCopyList : ('a -> 'a list) -> 'a list -> 'a list
val filterNoCopy : ('a -> bool) -> 'a list -> 'a list
val joinStrings : string -> string list -> string
Join a list of strings
val hasPrefix : string -> string -> bool
hasPrefix prefix str returns true with str starts with prefix
val restoreRef : ?deepCopy:('a -> 'a) -> 'a Pervasives.ref -> unit -> unit
Given a ref cell, produce a thunk that later restores it to its current
value
val restoreHash : ?deepCopy:('a -> 'a) -> ('b, 'a) Hashtbl.t -> unit -> unit
Given a hash table, produce a thunk that later restores it to its
current value
val restoreIntHash : ?deepCopy:('a -> 'a) -> 'a Inthash.t -> unit -> unit
Given an integer hash table, produce a thunk that later restores it to
its current value.
val restoreArray : ?deepCopy:('a -> 'a) -> 'a array -> unit -> unit
Given an array, produce a thunk that later restores it to its current
value.
val runThunks : (unit -> unit) list -> unit -> unit
Given a list of thunks, produce a thunk that runs them all
val memoize : ('a, 'b) Hashtbl.t -> 'a -> ('a -> 'b) -> 'b
val findOrAdd : ('a, 'b) Hashtbl.t -> 'a -> ('a -> 'b) -> 'b
Just another name for memoize
val tryFinally : ('a -> 'b) -> ('b option -> unit) -> 'a -> 'b
val valOf : 'a option -> 'a
Get the value of an option. Raises Failure if None
val out_some : 'a option -> 'a
val opt_bind : ('a -> 'b option) -> 'a option -> 'b option
val opt_app : ('a -> 'b) -> 'b -> 'a option -> 'b
val opt_iter : ('a -> unit) -> 'a option -> unit
val fold_for : init:'a -> lo:int -> hi:int -> (int -> 'a -> 'a) -> 'a
An accumulating for loop.
Initialize the accumulator with init. The current index and accumulator
from the previous iteration is passed to f.
type
configData =
| |
ConfInt of int |
| |
ConfBool of bool |
| |
ConfFloat of float |
| |
ConfString of string |
| |
ConfList of configData list |
The configuration data can be of several types *
val loadConfiguration : string -> unit
Load the configuration from a file
val saveConfiguration : string -> unit
Save the configuration in a file. Overwrites the previous values
val clearConfiguration : unit -> unit
Clear all configuration data
val setConfiguration : string -> configData -> unit
Set a configuration element, with a key. Overwrites the previous values
val findConfiguration : string -> configData
Find a configuration elements, given a key. Raises Not_found if it cannot
find it
val findConfigurationInt : string -> int
Like findConfiguration but extracts the integer
val useConfigurationInt : string -> (int -> unit) -> unit
Looks for an integer configuration element, and if it is found, it uses
the given function. Otherwise, does nothing
val findConfigurationFloat : string -> float
val useConfigurationFloat : string -> (float -> unit) -> unit
val findConfigurationBool : string -> bool
val useConfigurationBool : string -> (bool -> unit) -> unit
val findConfigurationString : string -> string
val useConfigurationString : string -> (string -> unit) -> unit
val findConfigurationList : string -> configData list
val useConfigurationList : string -> (configData list -> unit) -> unit
type
symbol = int
Symbols are integers that are uniquely associated with names
val symbolName : symbol -> string
Get the name of a symbol
val registerSymbolName : string -> symbol
Register a symbol name and get the symbol for it
val registerSymbolRange : int -> (int -> string) -> symbol
Register a number of consecutive symbol ids. The naming function will be
invoked with indices from 0 to the counter - 1. Returns the id of the
first symbol created. The naming function is invoked lazily, only when the
name of the symbol is required.
val newSymbol : string -> symbol
Make a fresh symbol. Give the name also, which ought to be distinct from
existing symbols. This is different from registerSymbolName in that it
always creates a new symbol.
val resetSymbols : unit -> unit
Reset the state of the symbols to the program startup state
val snapshotSymbols : unit -> unit -> unit
Take a snapshot of the symbol state. Returns a thunk that restores the
state.
val dumpSymbols : unit -> unit
Dump the list of registered symbols
Int32 Operators
module Int32Op: sig
.. end
val equals : 'a -> 'a -> bool
This has the semantics of (=) on OCaml 3.07 and earlier. It can
handle cyclic values as long as a structure in the cycle has a unique
name or id in some field that occurs before any fields that have cyclic
pointers.
module type Mapl = sig
.. end
module Mapl_Make:
module IntMapl: sig
.. end
val printStages : bool Pervasives.ref
val print_list : (Format.formatter -> unit -> unit) ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
Deprecated: see pretty_list instead
val print_if : bool -> Format.formatter -> (Format.formatter -> unit -> unit) -> unit
val comma : Format.formatter -> unit -> unit
val underscore : Format.formatter -> unit -> unit
val semi : Format.formatter -> unit -> unit
val space : Format.formatter -> unit -> unit
val alt : Format.formatter -> unit -> unit
val newline : Format.formatter -> unit -> unit
val arrow : Format.formatter -> unit -> unit
val nothing : Format.formatter -> unit -> unit
val pretty_list : (Format.formatter -> unit) ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
pretty sep print fmt l
pretty-prints the elements of l
according
to the formatting function print
separated by sep
on fmt
val pretty_list_del : (Format.formatter -> unit) ->
(Format.formatter -> unit) ->
(Format.formatter -> unit) ->
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
pretty_list_del before after sep print fmt l
is the same as
pretty_list
, but non-empty lists are enclosed between
before
and after
val pretty_opt : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a option -> unit
val pretty_opt_nl : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a option -> unit
val space_sep : string -> Format.formatter -> unit
separator + breakable space
val nl_sep : Format.formatter -> unit
forces newline
type
opaque_term_env = {
}
Environment for placeholders in term to exp translation
type
opaque_exp_env = {
}
Environment for placeholders in exp to term translation