LibGeneral-purpose library functions
Creates a directory and all of its parents if it does not already exist.
Return the value of an option type, raise Invalid_argument "get" if the option value is None
Return the min between two optional floats. Return None if both floats are None.
string_starts_with s1 s2 returns true if the first characters of s1 up to the length of s2 are ientical to s2. Return false if s2 is longer than s1.
safe_hash_interleave h m i compute m * h + i and makes sure that the result does not overflow to a negtive number
Add element to the head of the list if the option value is not None.
The function symbol is right-associative and infix:
Some 1 @:: None @:: Some 2 @:: [3;4] returns
\[1;2;3;4\] Return the index of the first element that satisfies the predicate p, raise excpetion Not_found if no element satisfies the predicate.
list_indexes l1 l2 returns the indexes in list l2 of elements in list l1
list_filter_nth l [p1; p2; ...] returns the elements l at positions p1, p2 etc.
Insert an element at a given position into a list
Apply a function to the nth element of a list
list_slice l i k returns a list containing the elements between the ith and kth element of l
list_suffix l i returns a list containing the elements between the ith and the last element of l
list_split n l divides list l into two at index n The first will contain all indices from [0,n) and the second will contain all indices from [n,len)
split3 l takes a list of triples and produces a triple of lists
chain_list_p [e1; e2; ...] is [(e1, e2); (e2, e3); ... ]
Return a list containing all values in the first list that are not in the second list
Merge two sorted lists without physical duplicates to a sorted list without physical duplicates
From two sorted lists without physical duplicates return a sorted list without physical duplicates containing elements in both lists
From two sorted lists without physical duplicates return a sorted list without physical duplicates containing elements in the first but not in the second list
For two sorted lists without physical duplicates return true if the first list contains a physically equal element for each element in the second list
Given two ordered association lists with identical keys, push the values of each element of the first association list to the list of elements of the second association list.
The returned association list is in the order of the input lists, the function equal is used to compare keys. Raise Failure "list_join" if the lists are not of identical length and the keys at each element are equal.
Lexicographic comparison of pairs
Apply a list of functions to a single argument. Kind of List.map but not really
val pp_print_pair :
(Stdlib.Format.formatter -> 'a -> unit) ->
(Stdlib.Format.formatter -> 'c -> 'd) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
('a * 'c) ->
'dPretty-print a pair. it excepts two formatters and a separator and formats the pair
val pp_print_triple :
(Stdlib.Format.formatter -> 'a -> unit) ->
(Stdlib.Format.formatter -> 'b -> unit) ->
(Stdlib.Format.formatter -> 'c -> 'd) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
('a * 'b * 'c) ->
'dPretty-print a triple. it excepts three formatters and a separator and formats the triple
val pp_print_arrayi :
(Stdlib.Format.formatter -> int -> 'a -> unit) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a array ->
unitPretty-print an array with given separator
pp_print_array elem_printer separator formatter array calls, for each index i of the array whose corresponding element is element, elem_printer formatter i element. Between each of these calls it prints the string separator.
In order to get line breaks between the elements, do not use a line feed character \n as separator, this might mess up indentation. Instead wrap the list into a vertical box with the format string @[<v>%a@] and the empty string as separator.
val pp_print_list :
(Stdlib.Format.formatter -> 'a -> unit) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a list ->
unitPretty-print a list with given separator
pp_print_list p s f l pretty-prints the elements in the list l by calling the pretty-printer p on each, separating the elements by printing the string s.
In order to get line breaks between the elements, do not use a line feed character \n as separator, this might mess up indentation. Instead wrap the list into a vertical box with the format string @[<v>%a@] and the empty string as separator.
val pp_print_listi :
(Stdlib.Format.formatter -> int -> 'a -> unit) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a list ->
unitPretty-print a list with given separator and maintain a counter of elements
See pp_print_list, except that the pretty-printer is passes an zero-based counter for the list's elements as the argument preceding the list element.
val pp_print_list2i :
(Stdlib.Format.formatter -> int -> 'a -> 'b -> unit) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a list ->
'b list ->
unitPretty-print two lists of the same length with given separator and maintain a counter of their elements.
val pp_print_option :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a option ->
unitPretty-print an option type
val pp_print_if_not_empty :
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a list ->
unitPretty-print if list is not empty
Return the width of the string, meaning the wisth of it's longest line
Return the strings as a parenthesized and space separated list
Levels of log messages
L_fatal A severe error that will lead to an immediate abortL_error An error event that might still allow to continueL_warn A potentially harmful situationL_note An important note (soft warning)L_info An informational message that highlight progress at a coarse-grained levelL_debug A fine-grained informational event that is useful for debugging but not for an end userL_trace A finer-grained informational event than L_debugval default_log_level : log_levelDefault log level.
val int_of_log_level : log_level -> intAssociate an integer with each level to induce a total ordering
val log_level_of_int : int -> log_levelval string_of_log_level : log_level -> stringval set_log_level : log_level -> unitSet log level
Only output messages of levels with equal or higher priority
val get_log_level : unit -> log_levelGets the log level.
val output_on_level : log_level -> boolReturn true if given log level is of higher or equal priority than current log level?
val ignore_or_fprintf :
log_level ->
Stdlib.Format.formatter ->
('a, Stdlib.Format.formatter, unit) Stdlib.format ->
'aReturn Format.fprintf if level is is of higher or equal priority than current log level, otherwise return Format.ifprintf
val ignore_or_kfprintf :
log_level ->
(Stdlib.Format.formatter -> 'a) ->
Stdlib.Format.formatter ->
('b, Stdlib.Format.formatter, unit, 'a) Stdlib.format4 ->
'bReturn Format.kfprintf if level is is of higher or equal priority than current log level, otherwise return Format.ikfprintf
type kind_module = [ | `IC3| `IC3QE| `IC3IA| `BMC| `BMCSKIP| `IND| `IND2| `INVGEN| `INVGENOS| `INVGENINT| `INVGENINTOS| `INVGENBV of int| `INVGENBVOS of int| `INVGENUBV of int| `INVGENUBVOS of int| `INVGENMACH| `INVGENMACHOS| `INVGENREAL| `INVGENREALOS| `C2I| `Interpreter| `CMonitor| `Supervisor| `Parser| `Certif| `MCS| `CONTRACTCK ]Kind modules
val pp_print_kind_module : Stdlib.Format.formatter -> kind_module -> unitPretty-print the name of a kind module
val string_of_kind_module : kind_module -> stringString representation of a process type
val int_of_kind_module : kind_module -> intString representation of a process type
val short_name_of_kind_module : kind_module -> stringReturn a short representation of kind module
val kind_module_of_string : string -> kind_moduleKind module of a string
pipe_for_child () is a pipe for a child process to be given one end of, as Unix.create_process gives it: both ends are closed on exec, and neither is left on one of the three standard descriptors, which is what a duplicate onto a standard descriptor of the child needs in order to happen at all. Without it the child starts with that descriptor closed.
Return full path to executable, search PATH environment variable and current working directory
Return full path to file if the file is found in the list of directories, or None otherwise *
val dummy_span : spanval dummy_pos : positionDummy position different from any valid position
val is_dummy_pos : position -> boolReturn true if the position is not a valid position in the input
set_stdin_id name sets name as the filename used in positions printed with pp_print_position when reading from standard input
val pp_print_position : Stdlib.Format.formatter -> position -> unitPretty-print a position
val pp_print_line_and_column : Stdlib.Format.formatter -> position -> unitPretty-print line and column
val pp_print_lines_and_columns :
Stdlib.Format.formatter ->
position list ->
unitval file_row_col_of_pos : position -> string * int * intReturn the file, line and column of a position; fail with Invalid_argument "file_row_col_of_pos" if the position is a dummy position
val file_of_pos : position -> stringReturn the file of a position
val row_col_of_pos : position -> int * intReturn the line and column of a position; fail with Invalid_argument "file_row_col_of_pos" if the position is a dummy position
val pos_of_file_row_col : (string * int * int) -> positionInverse of file_row_col_of_pos
val position_of_lexing : Stdlib.Lexing.position -> positionConvert a position of the lexer to a position
Pretty print a backtrace
val pp_print_bound_opt : Stdlib.Format.formatter -> Numeral.t option -> unitmodule Paths : sig ... endPaths Kind 2 can write some files. Factored to avoid clashes.
module ReservedIds : sig ... endReserved identifiers.
module ExitCodes : sig ... endExit codes.
module Names : sig ... endFile names.
module StringValues : sig ... endInternal string values
Give the calling domain a range of its own to number the names it invents in, so that no two domains invent the same name and the names a domain invents do not depend on what its siblings did. The engines pass their identifier; the supervisor keeps 0. Call before inventing any name in the domain.