Updated Algorithm switcher to change on pool rather than on algorithm.
This way if, for example, 2 pools use the same algorithm but different
GPU settings, the settings will be applied when changing pool.
Additionally:
* Included a "common" algorithm type in API pool/profile listing. For
example using "marucoin-mod" will return "X13", "darkcoin-mod" will
return "X11", scrypt + nfactor != 10 will return "NScrypt", etc...
* Added "kernel" config option to be backwards compatible with other
miners' configs.
* Added a few algorithm aliases: x11mod -> darkcoin-mod, x13mod ->
marucoin-mod...
* New config keyword: "includes", which holds an array of include files.
This is to counter the JSON limitation not allowing multiple values with
the same name, thus preventing inclusion of multiple files.
Sometimes the json parser, will read/apply nfactor before algorithm is set. When that is the case, set_algorithm() will reset nfactor to 10 preventing nscrypt from loading properly. Corrected the function to use previously set nfactor or default to 10.
Also squashed:
config: add log messages to set_algo() and set_nfactor().
algorithm: use set_algorithm_nfactor() when setting default nfactor in set_algorithm().
Otherwise algorithm->n defaults to 0.
P.S. Did I already mention how this could have been C++?..
Had two bugs:
1. Will not compile due to unknown algorithm_t size.
2. nfactor is set to 0 (bad calling, fix later).
So squashed two commits:
1. algorithm: move algorithm_t definition to header.
2. config: if --nfactor is specified, properly set algorithm->nfactor.
Doc in `doc/configuration.md` (has to be started sometime, no?).
Configuration function has to be lamely-named set_algo(), because
set_algorithm() is already declared in algorithm.h (prevent namespace
conflict).
algorithm has to be added as global variable due to the way the
callback is done (by CCAN/opt, which in itself is nice).
This can be cleaned up significantly by (at least) introducing a
global configuration struct, but there is no reason to do it now
just for this - better a wholesale manana.