module Options:This module implements a simple mechanism to handle program options files. An options file is defined as a set ofsig..end
variable = value lines,
where value can be a simple string, a list of values (between brackets
or parentheses) or a set of variable = value lines between braces.
The option file is automatically loaded and saved, and options are
manipulated inside the program as easily as references.
Code from Fabrice Le Fessant.
type 'a option_class
type 'a option_record
type options_file
val create_options_file : string -> options_fileval set_options_file : options_file -> string -> unitval prune_file : options_file -> unitval load : options_file -> unitload file loads the option file. All options whose value is specified
in the option file are updated.val append : options_file -> string -> unitappend filename loads the specified option file. All options whose
value is specified in this file are updated.val save : options_file -> unitsave file saves all the options values to the option file.val save_with_help : options_file -> unitsave_with_help () saves all the options values to the option file,
with the help provided for each option.val define_option : options_file ->
string list ->
string -> 'a option_class -> 'a -> 'a option_recordval option_hook : 'a option_record -> (unit -> unit) -> unitval string_option : string option_classval color_option : string option_classval font_option : string option_classval int_option : int option_classval bool_option : bool option_classval float_option : float option_classval string2_option : (string * string) option_classval list_option : 'a option_class -> 'a list option_classval smalllist_option : 'a option_class -> 'a list option_classval sum_option : (string * 'a) list -> 'a option_classval tuple2_option : 'a option_class * 'b option_class ->
('a * 'b) option_classval tuple3_option : 'a option_class * 'b option_class * 'c option_class ->
('a * 'b * 'c) option_classval tuple4_option : 'a option_class * 'b option_class * 'c option_class *
'd option_class -> ('a * 'b * 'c * 'd) option_classval (!!) : 'a option_record -> 'aval (=:=) : 'a option_record -> 'a -> unitval shortname : 'a option_record -> stringval get_help : 'a option_record -> stringval get_class : 'a option_record -> 'a option_classval class_hook : 'a option_class -> ('a option_record -> unit) -> unittype option_value =
| |
Module of |
| |
StringValue of |
| |
IntValue of |
| |
FloatValue of |
| |
List of |
| |
SmallList of |
typeoption_module =(string * option_value) list
val define_option_class : string ->
(option_value -> 'a) ->
('a -> option_value) -> 'a option_classval to_value : 'a option_class -> 'a -> option_valueval from_value : 'a option_class -> option_value -> 'aval value_to_string : option_value -> stringval string_to_value : string -> option_valueval value_to_int : option_value -> intval int_to_value : int -> option_valueval bool_of_string : string -> boolval value_to_bool : option_value -> boolval bool_to_value : bool -> option_valueval value_to_float : option_value -> floatval float_to_value : float -> option_valueval value_to_string2 : option_value -> string * stringval string2_to_value : string * string -> option_valueval value_to_list : (option_value -> 'a) -> option_value -> 'a listval list_to_value : ('a -> option_value) -> 'a list -> option_valueval smalllist_to_value : ('a -> option_value) -> 'a list -> option_valueval set_simple_option : options_file -> string -> string -> unitval simple_options : options_file -> (string * string) listval get_simple_option : options_file -> string -> stringval set_option_hook : options_file -> string -> (unit -> unit) -> unitval set_string_wrappers : 'a option_record -> ('a -> string) -> (string -> 'a) -> unitval simple_args : options_file -> (string * Arg.spec * string) list