Up

module BaseEnv

: sig

Read-write access to 'setup.data'

Author Sylvain Le Gall
#
type origin_t =
# | ODefault
(*Default computed value.*)
# | OGetEnv
(*Extracted from environment, using Sys.getenv.*)
# | OFileLoad
(*From loading file setup.data.*)
# | OCommandLine
(*Set on command line.*)

Origin of the variable, if a variable has been already set with a higher origin, it won't be set again.

#
type cli_handle_t =
# | CLINone
(*No command line argument.*)
# | CLIAuto
(*Build using variable name and help text.*)
# | CLIWith
(*Use prefix --with-.*)
# | CLIEnable
(*Use --enable/--disable.*)
# | CLIUser of (Arg.key * Arg.spec * Arg.doc) list
(*Fully define the command line arguments.*)

Command line handling for variable.

#
type definition_t = {
# hide
: bool;(*Hide the variable.*)
# dump
: bool;(*Dump the variable.*)
# cli
: cli_handle_t;(*Command line handling for the variable.*)
# arg_help
: string option;(*Help about the variable.*)
# group
: OASISTypes.name option;(*Group of the variable.*)
}

Variable type.

#
val schema : (origin_t, definition_t) PropList.Schema.t

Schema for environment.

#
val env : PropList.Data.t

Data for environment.

#
val var_expand : string -> string

Expand variable that can be found in string. Variable follow definition of variable for Buffer.add_substitute.

#
val var_get : OASISTypes.name -> string

Get variable.

#
val var_choose : ?printer:('a -> string) -> ?name:string -> 'a OASISExpr.choices -> 'a

Choose a value among conditional expressions.

#
val var_protect : string -> string

Protect a variable content, to avoid expansion.

#
val var_define : ?hide:bool -> ?dump:bool -> ?short_desc:(unit -> string) -> ?cli:cli_handle_t -> ?arg_help:string -> ?group:string -> OASISTypes.name -> (unit -> string) -> unit -> string

Define a variable.

#
val var_redefine : ?hide:bool -> ?dump:bool -> ?short_desc:(unit -> string) -> ?cli:cli_handle_t -> ?arg_help:string -> ?group:string -> OASISTypes.name -> (unit -> string) -> unit -> string

Define a variable or redefine it.

#
val var_ignore : (unit -> string) -> unit

Well-typed ignore for var_define.

#
val print_hidden : unit -> string

Display all variables, even hidden one.

#
val var_all : unit -> OASISTypes.name list

Get all variables.

#
val default_filename : OASISTypes.host_filename

Environment default file.

#
val load : ?allow_empty:bool -> ?filename:OASISTypes.host_filename -> unit -> unit

Initialize environment.

#
val unload : unit -> unit

Uninitialize environment.

#
val dump : ?filename:OASISTypes.host_filename -> unit -> unit

Save environment on disk.

#
val print : unit -> unit

Display environment to user.

#
val args : unit -> (Arg.key * Arg.spec * Arg.doc) list

Default command line arguments, computed using variable definitions.

end