Independent modules are modules that you, the user, may write as additions to the Arachne code package. Arachne is designed so that it is easy to add these modules. See Compilation for information on how to design these modules for easy compilation.
Things to include
An executable module, by definition, must have a
main() function. Arachne recognizes which modules are executable by searching for a line of code that begins:
This exact syntax is necessary; there must be no space before
int, exactly one space between
main, and no space between
main and the opening parenthesis. (After this parenthesis may follow a space, or anything else.) If a module is executable, it should
#include MainTools.h. It is also a good idea to call
If your module accepts any command-line arguments, use the ParsedArgs module to handle them. In this case, running the module with no arguments will always produce an informative, automatically generated documentation of the command-line arguments needed. The arguments GDB and NO_HEADER are always accepted.
Useful features from the Arachne code package
AssertXX()will test unless NDEBUG is set
ForceAssertXX()will always test, and moreover prevents inlining: use with caution in often called methods!
#define FAST_ASSERTallows inlining of ForceAsserts.
Include the following macros at the very top of your files. This turns off Asserts (Assert, AssertLt, AssertEq, etc), allowing methods that contain them, such as vec::operator, to be inlined. ForceAsserts are not affected by this.
#ifndef FORCE_DEBUG #define NDEBUG #endif
If your code does a lot of work with strings, particularly comparisons and operator, this will allow many of these operations to be inlined.
We have some typedefs that are used throughout the code (defined in Types.h):
An unsigned char with two archetypal constants: True (1) and False (0). The motivation for Bool is that the size of the built-in type bool varies from platform to platform, and can be as large as 64 bits, while Bool is always an unsigned char, i.e. one byte.
The built-in type long can vary in size from platform to platform; longlong is always 64 bits.