Cobol_configThis library is used to build configuration modules, either from file or from a dialect. All the from_ functions will fail if a file is not found, or use the default value of any options that is badly typed in the configuration file or not set in the configuration file.
module Types : sig ... endModule containing most of the types definitions used in Cobol_config.
include module type of Typestype doc = Pretty.simpleGlobal configuration representative (default, gcos, gcos-strict, etc). Just a name for now, but we could add some more info later (like configuration files read).
class type showable = object ... endAny object with a pretty-printing method.
class virtual 'a kind : name:string -> object ... endKind (type) of configuration options.
val all_configs : showable list Stdlib.refclass virtual 'a configurable : name:string -> kind:'a kind -> ?short:doc option -> doc -> object ... endAny object that is configurable.
module FEATURE = Types.FEATUREtype 'a feature = 'a FEATURE.ttype 'a feature_support = 'a FEATURE.supportmodule DIAG = Types.DIAGmodule Value = Types.Valuetype 'a valued_option = 'a Value.vtype 'a value = 'a Value.ttype standard = Types.standard = type source_format = Types.source_format = type words_spec = (string * word_spec) listand word_spec = Types.word_spec = module DIALECT = Types.DIALECTtype dialect = DIALECT.tmodule type CONFIG = Types.CONFIGmodule type PP_OPTS = Types.PP_OPTSmodule type COMP_OPTS = Types.COMP_OPTSmodule type T = Types.Ttype t = (module T)module Options : sig ... endmodule Default : sig ... endmodule Diagnostics : sig ... endexception ERROR of Diagnostics.errorval default : (module T)Search path (suspension).
When evaluated (via Lazy.force), default_search_path is a path that is equivalent to
".:$XDG_CONFIG_HOME/superbol:$COB_CONFIG_DIR"
.
Changing environment variables or the current working directory has no impact on the resulting path when done after evaluation.
val from_file :
?search_path:string list ->
?verbose:bool ->
string ->
(module T) Cobol_common.Diagnostics.with_diagsfrom_file ~search_path filename loads a configuration module from the given filename. Note: the evaluation of default_search_path is forces in case search_path is not provided.
val from_dialect :
?search_path:string list ->
?verbose:bool ->
Types.DIALECT.t ->
(module T) Cobol_common.Diagnostics.with_diagsfrom_dialect ~search_path dialect returns the configuration module according to the dialect defaults. The caveat about default_search_path given for from_file applies here as well.