Module Goptions

This module manages customization parameters at the vernacular level

type option_name = string list
type option_locality =
| OptDefault
| OptLocal
| OptExport
| OptGlobal
Tables.
module MakeStringTable : functor (A : sig ... end) -> sig ... end
module MakeRefTable : functor (A : sig ... end) -> sig ... end
Options.
type 'a option_sig = {
optstage : Summary.Stage.t;
optdepr : Deprecation.t option;

whether the option is DEPRECATED

optkey : option_name;

the low-level name of this option

optread : unit -> 'a;
optwrite : 'a -> unit;
}
val declare_int_option : ?⁠preprocess:(int option -> int option) -> int option option_sig -> unit
val declare_bool_option : ?⁠preprocess:(bool -> bool) -> bool option_sig -> unit
val declare_string_option : ?⁠preprocess:(string -> string) -> string option_sig -> unit
val declare_stringopt_option : ?⁠preprocess:(string option -> string option) -> string option option_sig -> unit
type 'a getter = {
get : unit -> 'a;
}

Wrapper type to separate the function calls to register the option at toplevel from the calls to read the option value.

type 'a opt_decl = ?⁠stage:Summary.Stage.t -> ?⁠depr:Deprecation.t -> key:option_name -> value:'a -> unit -> 'a getter
val declare_int_option_and_ref : int opt_decl
val declare_intopt_option_and_ref : int option opt_decl
val declare_nat_option_and_ref : int opt_decl
val declare_bool_option_and_ref : bool opt_decl
val declare_string_option_and_ref : string opt_decl
val declare_stringopt_option_and_ref : string option opt_decl
val declare_interpreted_string_option_and_ref : (string -> 'a) -> ('a -> string) -> 'a opt_decl
Special functions supposed to be used only in vernacentries.ml
module OptionMap : CSig.MapS with type key = option_name
type 'a table_of_A = {
add : Environ.env -> 'a -> unit;
remove : Environ.env -> 'a -> unit;
mem : Environ.env -> 'a -> unit;
print : unit -> unit;
}
val get_string_table : option_name -> string table_of_A
val get_ref_table : option_name -> Libnames.qualid table_of_A
val set_int_option_value_gen : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> option_name -> int option -> unit

The first argument is a locality flag. If stage is provided, the option is set/unset only if it is declared in the corresponding stage. If omitted, the option is always set/unset.

val set_bool_option_value_gen : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> option_name -> bool -> unit
val set_string_option_value_gen : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> option_name -> string -> unit
val set_string_option_append_value_gen : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> option_name -> string -> unit
val unset_option_value_gen : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> option_name -> unit
val set_int_option_value : ?⁠stage:Summary.Stage.t -> option_name -> int option -> unit
val set_bool_option_value : ?⁠stage:Summary.Stage.t -> option_name -> bool -> unit
val set_string_option_value : ?⁠stage:Summary.Stage.t -> option_name -> string -> unit
val print_option_value : option_name -> unit
type option_value =
| BoolValue of bool
| IntValue of int option
| StringValue of string
| StringOptValue of string option
type table_value =
| StringRefValue of string
| QualidRefValue of Libnames.qualid
val get_option_value : option_name -> (unit -> option_value) option

get_option_value key returns None if option with name key was not found.

val set_option_value : ?⁠locality:option_locality -> ?⁠stage:Summary.Stage.t -> ('a -> option_value -> option_value) -> option_name -> 'a -> unit

set_option_value ?locality f name v sets name to the result of applying f to v and name's current value. Use for behaviour depending on the type of the option, eg erroring when 'a doesn't match it. Changing the type will result in errors later so don't do that.

type option_state = {
opt_depr : Deprecation.t option;
opt_value : option_value;
}

Summary of an option status

val get_tables : unit -> option_state OptionMap.t
val print_tables : unit -> Pp.t
type iter_table_aux = {
aux : a. 'a table_of_A -> Environ.env -> 'a -> unit;
}
val iter_table : Environ.env -> iter_table_aux -> option_name -> table_value list -> unit
val error_undeclared_key : option_name -> 'a