Many C and C++ programmers make extensive use of macros. These enable the programmer to write code that is changed even while it is being compiled. Frequently this is done to make code more efficient without making it obscure to read. For example, one might define a macro such as:
#define next_char() charpt++
This would mean that the programmer would write next_char(), but instead of this compiling into a function call, it would be replaced at compile time by the code "charpt++", which increments a pointer (usually one machine instruction).
C macros have a bad reputation (which lead to their exclusion from the Java language), because they can obscure code. Usually this is unintentional, but there is an international competition to produce the most obscure C code possible – usually achieved using macros!
C macros, as defined in C/C++ operate before an expression is even parsed. The macros implemented in the MacroProcessor package, operate after parsing – retaining most of their real value, without such an ability to confuse!
These macros perform substitutions on the right hand side of every delayed assignment – which obviously includes most function definitions.
Obtaining and installing the package
The MacroProcessor package is free and Version 1.0 (a slightly enhanced version of the software I showed in my talk at the recent technology conference in Champaign) can be downloaded as a ZIP file containing all the files required in their appropriate directories. It is vital that this directory structure is preserved. Copy the file to the $UserBaseDirectory. Unzip the file macroprocessor.ZIP using a tool that preserves the directory structure and handles long names correctly, e.g. PKZIP(R) Version 2.50, or WinZip(R).
The documentation is contained inside the package in standard Documentation Center format, so type MacroProcessor into the DC to get the details of how to use this simple (but hopefully useful!) package.
$h2 Version 1.01
This is the current version, it contains some fixes to the documentation/DC interface.