All predicatesShow sourceconf_d.pl -- Load configuration directories

This module deals with loading configuration-files from a directory. This is pretty simple because we assume that configuration files are Prolog source-files. We (can) use file_search_path/2 to define one or more configuration directories.

Files are loaded in alphabetical order. If one config file requires another, there are two solutions:

Source load_conf_d(+Spec, +Options) is det
Locate configuration directories and load their config files. Config files themselves are Prolog source files. Options:
solutions(+Sols)
Passed to absolute_file_name/3. Default is all, loading config files from all directories described by Spec.
extension(+Ext)
File-name extension for the config files. Default is pl.

Other options are passed to load_files/2.

Arguments:
Spec- is either the specification of a directory according to absolute_file_name/3 or a list thereof. Duplicate directories are removed.
To be done
- There is a bug forking processes in one thread and waiting for X11 in another, which deadlocks in fork_atfree(). So, we must ensure we have the git versions in time :-(
Source keep_last(+PairsIn, -PairsOut) is det[private]
PairsIn is a list Dir-Files holding Files to be loaded from Dir. We remove all files from Files that appear with a later directory.
Source conf_d_enabled(-Dir) is nondet
True if Dir is a directory from which config files are loaded.
Source conf_d_reload is det
Reload configuration files after adding or deleting config files. Note that this is not exactly the same as restarting the server. First of all, the order in which the files are loaded may be different and second, wiping a config file only wipes the clauses and module. Side effects, for example due to executed directives, are not reverted.
Source conf_d_members(+Dir, -InfoRecords:list, Options) is det
Provide information about config files in Dir.
Arguments:
InfoRecords- is a list of terms. The predicate conf_d_member_data/3 must be used to extract data from these terms.
Source conf_d_member_data(?Field, +ConfigInfo, ?Value) is nondet
True if Value is the value for Field in ConfigInfo. ConfigInfo is an opaque term as returned by conf_d_info/3. Defined fields are:
file
Absolute path of the file
module
Module defined in the file (can fail)
title
Comment-title (from /** <module> Title .. */)
loaded
Boolean, indicating whether the file is currently loaded.
Source set_top_dir[private]
Maintains a file search path cp_application to point to the directory from which the configuration is loaded. Normally, that is the directory holding run.pl.
Source conf_d_configuration(+Available, +Enabled, -Configs) is det
Arguments:
Available- is a directory or alias providing the available configurations (e.g., config_available(.))
Enabled- is a directory or alias providing the installed configuration (e.g., 'config-enabled')
Configs- is a list if Key-[Example,Installed], where either is (-) or a config data item as required by conf_d_member_data/3. The list is sorted on Key.
Source merge_pairlists(+PairLists, -Merged)[private]
PairLists is a list of lists of K-V pairs. Merged is a K-VL list, where each VL is a list of values on K in PairLists. Missing values are returned as (-). For example:
?- merge_pairlists([ [a-1, d-4],
                     [a-1, c-3],
                     [b-2]
                   ], Merged).
Merged = [a-[1,1,-], b-[-,-,2], d-[4,-,-], c-[-,3,-]].
To be done
- Is this useful and generic enough for library(pairs)?