Module Oug_misc

module Oug_misc: sig .. end
Misc functions.

val create_log_fun : ?prefix:string ->
?print:(string -> unit) ->
string -> ?loc:string -> ?level:int -> (unit -> string) -> unit
Creating a log function. create_log_fun env_var get the log level (an integer) from the given environment variable, and returns a function to print messages. This function takes a level (default is 1) and a function returning the message do print. The function is called only if the log level is higher than or equal to the given level. The loc parameter of the returned function can be used to indicate an additional string to print before the log message. If the environment variable is empty or does not contain an integer, then the log level is set to 0.
prefix : can be used to indicate a string prefixing every message
print : can be given to the function build the log function, to indicate an alternative way to display the message; default is to call prerr_endline.
val create_log_fun_with_set : ?prefix:string ->
?print:(string -> unit) ->
string ->
(?loc:string -> ?level:int -> (unit -> string) -> unit) *
((int -> int) -> unit)
Same as create_log_fun but also return a function f which can be used to change the log level. f must be given a function takin the previous log level and returning the new log level.
val no_blanks : string -> string
no_blanks s returns the given string without any blank characters, i.e. '\n' '\r' ' ' '\t'.
Version: 1.0
val split_string : ?keep_empty:bool -> string -> char list -> string list
Separate the given string according to the given list of characters.
Author(s): Maxence Guesdon
Version: 1.1
keep_empty : is false by default. If set to true, the empty strings between separators are kept.
val list_remove_doubles : ?pred:('a -> 'a -> bool) -> 'a list -> 'a list
list_remove_doubles ?pred l remove doubles in the given list l, according to the optional equality function pred. Default equality function is (=).
Author(s): Maxence Guesdon
Version: 1.0
val safe_main : (unit -> unit) -> unit
safe_main f calls f () but handles Sys_error and Failure exceptions by exiting with error code 1.
Author(s): Maxence Guesdon
Version: 1.0
val list_diff : ?pred:('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list
list_diff l1 l2 returns the list l1 - l2.
Author(s): Maxence Guesdon
Version: 1.0
pred : can be sued to specify the equality predicate (default is (=)).
module String_map: Map.S  with type key = string