module Conf:sig
..end
Configuration management module.
typelink =
string
Type for links between keys
typepath =
link list
Type for paths between keys
type
ut = <
|
comments : |
|
descr : |
|
kind : |
|
path : |
|
plug : |
|
routes : |
|
subs : |
|
ut : |
Type for untyped keys (or keys with unknown type)
kind
: a string describing the type of this keydescr
: a key description/titlecomments
: some comments on the key purposesplug
: a way to plug subkeyssubs
: the list of link names to subkeyspath
: a way to access subkeysroutes
: a way to find paths to an other keytype 'a
t = <
|
alias : |
|
comments : |
|
descr : |
|
get : |
|
get_d : |
|
kind : |
|
on_change : |
|
path : |
|
plug : |
|
routes : |
|
set : |
|
set_d : |
|
subs : |
|
ut : |
Type for 'a keys
ut
: cast to un untyped keyset_d
: set the default value associated to the keyget_d
: get the default value associated to the keyset
: set the key value according to a user demmandget
: retrieve the resulting key valuetypelinks =
(link * ut) list
A set of connections to others keys
exception Undefined of ut
Raised on access to an undefined key (without default value)
exception Invalid of string
Raised when an invalid link has been specified
exception Unbound of ut * string
Raised when a specified link does not exist
exception Bound of ut * string
Raised when a specified link already exist
exception Mismatch of ut
Raised on access to a key with a mismatching type
exception Cyclic of ut * ut
Raised on cyclic plug
exception Wrong_Conf of string * string
Raised when bad configuration assignations are encountered
exception File_Wrong_Conf of string * int * string
Raised when bad configuration assignations are encountered inside configuration files
type'a
builder =?d:'a ->
?p:(ut -> unit) ->
?l:links -> ?comments:string list -> string -> 'a t
Receipt to build a 'a key
val unit : unit builder
val int : int builder
val float : float builder
val bool : bool builder
val string : string builder
val list : string list builder
Some key builders
val void : ?p:(ut -> unit) ->
?l:links -> ?comments:string list -> string -> ut
A structural key builder
val as_unit : ut -> unit t
val as_int : ut -> int t
val as_float : ut -> float t
val as_bool : ut -> bool t
val as_string : ut -> string t
val as_list : ut -> string list t
Casts to specificaly typed keys.
Raises Mismatch
on mismatching cast.
val path_of_string : string -> path
Convert a dot separated string to a path
val string_of_path : path -> string
Convert a path to a dot separated string
val descr : ?prefix:path -> ut -> string
Generate a description table of a (sub)key
val dump : ?prefix:path -> ut -> string
Dump the configuration table for a (sub)key
val conf_set : ut -> string -> unit
Add a value to the configuration keys, according to the given
correctly formated string: "type key :value"
Raises Wrong_Conf
in badly formated cases.
val conf_file : ut -> string -> unit
Read configuration values from the file associated with the given
filename.
Raises File_Wrong_Conf
with filename line and and error message
in case of a bad configuration file.
val args : ut -> (string list * Stdlib.Arg.spec * string) list
A set of command line options to be used with the Arg module.