X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fregistry%2Fhelm_registry.mli;h=668525b86a13e49f034df503d782a0fba9915e34;hb=9be7ec5bbacfafed8a3e37cfe0095f2aea1b9bf9;hp=02c0df76b8ec1bb4d3a4b3a5216c251644c69ec8;hpb=cdc2c0c2ba2831239dcaad706bba8c73ab27723f;p=helm.git diff --git a/helm/ocaml/registry/helm_registry.mli b/helm/ocaml/registry/helm_registry.mli index 02c0df76b..668525b86 100644 --- a/helm/ocaml/registry/helm_registry.mli +++ b/helm/ocaml/registry/helm_registry.mli @@ -25,17 +25,35 @@ (** Configuration repository for HELM applications. * - * key ::= path - * path ::= component ( '.' component )* - * component ::= ( alpha | num | '_' )+ + * ++ Keys format ++ * - * Suggested usage .: - * e.g. gTopLevel.prooffile, http_getter.port, ... + * key ::= path + * path ::= component ( '.' component )* + * component ::= ( lowercase_alpha | num | '_' )+ + * # with the only exception that sequences of '_' longer than 1 aren't valid + * # components * - * Configuration file example: + * Suggested usage .: + * e.g. gTopLevel.prooffile, http_getter.port, ... + * + * ++ Configuration file example ++ * * gTopLevel.prooffile = "/home/zack/prooffile" * http_getter.port = "58080" + * + * ++ Environment variable override ++ + * + * each key has an associated environment variable name. At runtime (i.e. when + * "get" requests are performed) a variable with this name will be looked for, + * if it's defined it will override the value present (or absent) in the + * registry. + * Environment variables are _not_ considered when saving the configuration to + * a configuration file (via "save_to" function below) . + * + * Mapping between keys and environment variables is as follows: + * - the whole key is uppercased + * - each "." is converted to "__" + * E.g.: my.foo_ish.application -> MY__FOO_ISH__APPLICATION *) (** raised when a looked up key can't be found @@ -54,8 +72,11 @@ exception Malformed_key of string (** raised when an error is encountered while parsing a configuration file * @param fname file name - * @param lno line number *) -exception Parse_error of string * int + * @param line line number + * @param col column number + * @param msg error description + *) +exception Parse_error of string * int * int * string (** raised when a given pair fails validity test(s) * @param pair pair @@ -66,6 +87,7 @@ exception Invalid_value of (string * string) * string * Using the functions below this module could be used as a repository of * key/value pairs *) + (** lookup key in registry with environment variable override *) val get: string -> string val set: key:string -> value:string -> unit @@ -75,10 +97,13 @@ val set: key:string -> value:string -> unit * parsing of an integer number from ; strings list to the splitting at blanks * of it (heading and trailing blanks are removed before splitting) *) +val get_string: string -> string (* alias for bare "get" above *) val get_int: string -> int val get_float: string -> float val get_string_list: string -> string list + (* alias for bare "set" above *) +val set_string: key:string -> value:string -> unit val set_int: key:string -> value:int -> unit val set_float: key:string -> value:float -> unit val set_string_list: key:string -> value:string list -> unit