http://sarrazip.com/dev/boolstuff.html

By Pierre Sarrazin*
BoolStuff is a C++ library that supports a few operations on boolean expression binary trees. The main features are:
A command named booldnf that calls this library to convert an expression to the DNF is also provided.
The current version is 0.1.13 (2010-02-14). The terms of the resulting DNF are now sorted so that duplicate terms can be eliminated. Compilation errors under g++ 4.4 have been fixed.
Note that the library's programming interface is not necessarily frozen. It will be frozen for version 1.0. No date has been set for a 1.0 version.
BoolStuff is free software distributed under the GNU General Public License. Please note that this means proprietary software linked with this library cannot be distributed legally.
I can be contacted (in French or English) at sarrazip at sarrazip dot com.
There are manual pages for the boolstuff(3) library and for the booldnf(1) command.
The definition of the DNF seems to vary. Dr. Math says that the DNF requires every variable or its complement [to be] represented in every term. However, MathWorld does not obey this requirement, judging from the examples given. My library does not obey it either.
For example, the expression a&(b|c) will be converted to a&b|a&c. There is no c in the first term and no b in the second one.
The source archive contains a short example and two test programs. They can be studied to learn how to use the library.
Halevt (HAL events manager) is a "daemon that executes arbitrary commands when a device with certain properties is added to the system and when device properties change." This program is distributed under the GNU GPL.
The library also comes with a C application programming interface. However, it still requires the program to link with libstdc++, the GNU Standard C++ library.
gcc must be used to compile the C source files, but g++ must be used to link the application. One hack to force Automake to do this is something like the following:
myapp_SOURCES = foo.c bar.c baz.c
nodist_myapp_SOURCES = dummy.cpp
# This forces Automake to use g++ to link the application.
# nodist means that Automake must not include this file
# in the distributed source tarball.
dummy.cpp:
echo 'static void dummy();' > $@
# We generate the dummy C++ source file so we don't have
# to think about it.
CLEANFILES = dummy.cpp
# This tells the 'clean' target to erase the generated file.
Of course, the _CFLAGS and _LDADD variables must also be set to refer to BoolStuff.
None of the following files exceeds 359 kilobytes in size.
(MD5 and SHA1 values of these files)
The non-development binary RPM packages only contain the shared library. The development packages contain the C++ header files, the .la libtool file, the .so symbolic link, and the .pc file for the pkg-config script. None of these RPMs contain a static version of the library.
The source archive contains an RPM .spec file, which allows you to build your own RPM by giving the following command:
rpmbuild -ta boolstuff-0.1.13.tar.gz
I wrote a small RPM Building Crash Course (also available in French).
The Fedora Core 3 binary RPMs were produced with g++ 4.4.1 and they use /usr as the installation prefix. They most probably will not work on RedHat 6.x and 7.x systems.
* The image is not of me, but of George Boole (1815-1864), an English mathematician who helped establish modern symbolic logic and whose algebra of logic, now called Boolean algebra, is basic to the design of digital computer circuits. The image is taken from Wikipedia and is in the public domain according to that site.
Last update to this page: 2012-04-09 01:27:51 EST5EDT