(************************************************************************) (* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************)
(** This module manages customization parameters at the vernacular level *)
(** Two kinds of things are managed : tables and options value -Tablesarecreatedbyapplyingthe[MakeTable]functor. -Variablesstoringoptionsvaluearecreatedbyapplyingoneofthe [declare_int_option],[declare_bool_option],...functions.
type option_locality = OptDefault | OptLocal | OptExport | OptGlobal
(** {6 Tables. } *)
(** The functor [MakeStringTable] declares a table containing objects oftype[string];thefunction[member_message]saywhattoprint wheninvokingthe"TestTotoTitifoo."command;attheend[title] isthetablenameprintedwheninvokingthe"PrintTotoTiti." command;[active]isroughlytheinternalversionofthevernacular "Test...":ittellsifagivenobjectisinthetable;[elements]
returns the list of elements of the table *)
module MakeStringTable :
functor
(_ : sig val key : option_name val title : string val member_message : string -> bool -> Pp.t end) -> sig val v : unit -> CString.Set.t val active : string -> bool end
(** The functor [MakeRefTable] declares a new table of objects of type [A.t]practicallydenotedby[reference];theencodingfunction [encode:env->reference->A.t]istypicallyaglobalizationfunction, possiblywithsomerestrictionchecks;thefunction [member_message]saywhattoprintwheninvokingthe"TestToto Titifoo."command;attheend[title]isthetablenameprinted wheninvokingthe"PrintTotoTiti."command;[active]isroughly theinternalversionofthevernacular"Test...":ittellsifa
given object is in the table. *)
module type RefConvertArg = sig type t
module Set : CSig.USetS withtype elt = t val encode : Environ.env -> Libnames.qualid -> t val subst : Mod_subst.substitution -> t -> t
val check_local : Libobject.locality -> t -> unit val discharge : t -> t (** Elements which cannot be discharged should only be added with Local *)
val printer : t -> Pp.t val key : option_name val title : string val member_message : t -> bool -> Pp.t end
module MakeRefTable :
functor (A : RefConvertArg) -> sig val v : unit -> A.Set.t val active : A.t -> bool valset : Libobject.locality -> A.t -> bool -> unit end
(** {6 Options. } *)
(** These types and function are for declaring a new option of name [key]andaccessfunctions[read]and[write];theparameter[name] istheoptionnameusedwhenprintingtheoptionvalue(command "PrintTotoTiti."
Thedeclare_*_optionfunctionsarelow-level,tobeusedwhen implementingcomplexoptionworkflows,e.g.whentheoptiondataisintheglobalenv. Formostusecases,youshoulduse
the helper functions declare_*_option_and_ref. *)
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
}
(** The [preprocess] function is triggered before setting the option. It can be usedtoemitawarningoncertainvalues,andclean-upthefinalvalue.
[StringOptKind] should be preferred to [StringKind] because it supports "Unset". *) val declare_option : ?preprocess:('a -> 'a) -> ?no_summary:bool ->
kind:'a option_kind -> 'a option_sig -> unit
val declare_append_only_option : ?preprocess:(string -> string) -> sep:string -> string option_sig -> unit
(** Helpers to declare a reference controlled by an option. *)
(** Wrapper type to separate the function calls to register the option
at toplevel from the calls to read the option value. *) type'a getter = { get : unit -> 'a }
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 : stringoption opt_decl val declare_interpreted_string_option_and_ref : (string -> 'a) -> ('a -> string) -> 'a opt_decl
(** {6 Special functions supposed to be used only in vernacentries.ml } *)
type'a table_of_A = {
add : Environ.env -> Libobject.locality -> 'a -> unit;
remove : Environ.env -> Libobject.locality -> '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
(** The first argument is a locality flag. If[stage]isprovided,theoptionisset/unsetonlyifitisdeclaredinthecorrespondingstage.
If omitted, the option is always set/unset. *) val set_int_option_value_gen : ?locality:option_locality -> ?stage:Summary.Stage.t -> option_name -> int option -> unit 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 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 ofbool
| IntValue of int option
| StringValue ofstring
| StringOptValue ofstringoption
type table_value =
| StringRefValue ofstring
| QualidRefValue of Libnames.qualid
(** [get_option_value key] returns [None] if option with name [key] was not found. *) val get_option_value : option_name -> (unit -> option_value) option
val set_option_value : ?locality:option_locality -> ?stage:Summary.Stage.t -> 'a check_and_cast -> option_name -> 'a -> unit (** [set_option_value ?locality f name v] sets [name] to the result of applying[f]to[v]and[name]'soptionkind.Useforbehaviour dependingonthetypeoftheoption,egerroringwhen['a]doesn't
match it. *)
(** Summary of an option status *) type option_state = {
opt_depr : Deprecation.t option;
opt_value : option_value;
}
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
(** Compat *)
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:(stringoption -> stringoption) -> stringoption option_sig -> unit
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.