Cobol_config
This 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 ... end
Module containing most of the types definitions used in Cobol_config
.
include module type of Types
type doc = Pretty.simple
Global 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 ... end
Any object with a pretty-printing method.
class virtual 'a kind : name:string -> object ... end
Kind (type) of configuration options.
val all_configs : showable list Stdlib.ref
class virtual 'a configurable : name:string -> kind:'a kind -> ?short:doc option -> doc -> object ... end
Any object that is configurable.
module FEATURE = Types.FEATURE
type 'a feature = 'a FEATURE.t
type 'a feature_support = 'a FEATURE.support
module DIAG = Types.DIAG
module Value = Types.Value
type 'a valued_option = 'a Value.v
type 'a value = 'a Value.t
type standard = Types.standard =
type source_format = Types.source_format =
type words_spec = (string * word_spec) list
and word_spec = Types.word_spec =
module DIALECT = Types.DIALECT
type dialect = DIALECT.t
module type CONFIG = Types.CONFIG
module type PP_OPTS = Types.PP_OPTS
module type COMP_OPTS = Types.COMP_OPTS
module type T = Types.T
type t = (module T)
module Options : sig ... end
module Default : sig ... end
module Diagnostics : sig ... end
exception ERROR of Diagnostics.error
val 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_diags
from_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_diags
from_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.