|Did you know ...||Search Documentation:|
|library(settings): Setting management|
library(config)distributed with XPCE provides an alternative aimed at graphical applications.
This library allows management of configuration settings for Prolog applications. Applications define settings in one or multiple files using the directive setting/4 as illustrated below:
:- use_module(library(settings)). :- setting(version, atom, '1.0', 'Current version'). :- setting(timeout, number, 20, 'Timeout in seconds').
Settings are local to a module. This implies they are defined in a two-level namespace. Managing settings per module greatly simplifies assembling large applications from multiple modules that configuration through settings. This settings management library ensures proper access, loading and saving of settings.
If a second declaration for a setting is encountered, it is ignored if Type and Default are the same. Otherwise a permission_error is raised.
|Name||Name of the setting (an atom)|
|Type||Type for setting. One of |
|Default||Default value for the setting.|
|Comment||Atom containing a (short) descriptive note.|
setting(Name, Value)only enumerates the settings of the current module. All settings can be enumerated using
setting(Module:Name, Value). This predicate is
detif Name is ground.
settings(changed(Module:Name, Old, New))
error, an error is printed and the setting is ignored. when
load, the setting is loaded anyway, waiting for a definition.
current_output. The second form only lists settings on the matching module.