Completely re-factor this code so that muli-statement macros are totally safe, and there is not a preponderance of inscrutable ifdefs guarding comprehension of the code.