The library allows to disable certain features at compile time. This simplifies the process of figuring out which code is dependent on which feature by for instance relying on compiler warnings to help trim the redundant code down. We then also want the test suite to pass on all these different configuration options of course.
At one point manually maintaining all those different possible combinations
of options particularly for the combinatorial tester became very tedious (an
earlier version of this README.md
file had a 11 step process to add a
new feature).
Now we automatically generate the code from the following files:
features.csv
is a list of options to disable features and their descriptionclashing.csv
is a list of pairs of clashing options (incompatible options)implied.csv
is a list of implications (one option implies another)
The utility generate
compiled from generate.c
will read
those files above, perform extensive sanity checking, then computes
transitive implications and finally generates the following set of files
files.
The first set consists of files read and used by
../configure
:
check.sh
checks that options are not implied nor clashingdefine.sh
produces corresponding C preprocessor flags '-N...'init.sh
initializes 'configure' option variablesparse.sh
is used for command line argument parsingusage.sh
prints usage for all the options
The second set is read by ../features.h
:
check.h
checks implied and clashing optionsdiagnose.h
diagnoses and prints final set of optionsinit.h
initializes additional (implied) options
The third set is read by ../gencombi
to generate test configurations:
invalid.h
contains pairs of invalid options (implied and clashing)list.h
contains list of all options (in C syntax)
And finally we read from ../config.c
(generated by ../mkconfig.sh
):
version.h
extends VERSION by the list of options
The build process for generate
is standard. Just use
./configure && make
to build 'generate' which uses the following files.
makefile.in
is the makefile templategenerate.c
is the source code of the feature file generatorREADME.md
is this README fileconfigure
is the configuration script
The build process of generate
does not depend on the configuration of the
main library. You also do no need to compile generate
at all if you do
not change the 'CSV' files. Otherwise just call
./generate
to generate all the files above. These generate files are also under
revision control since changing features is rare. This avoids building
and executing generate
during the build process of the solver but requires
that you update the generated files (by calling generate
) manually after
changing one of the "CSV" files.
You can also use the following command instead.
./generate -v
It produces some more information as verbose messages.