9.4. Conditional macro code

If macro code is spanned across several files or is shared between TrEd and bTrEd, it may be useful to make some parts of the macro code (such as an #include directive) conditional.

For this purpose TrEd, provides similar mechanisms as standard C pre-processors using #define, #undefine, #ifdef, #ifndef, and #endif directives. These directives must appear on the very beginning of line. Any code enclosed within

#ifdef symbol-name

and

#endif

directives is included if and only if the symbol symbol-name was previously defined using a #define symbol-name directive. Any code enclosed within

#ifndef symbol-name

and

#endif

directives is included if and only if the symbol symbol-name is not defined. A defined symbol can later be undefined with #undefine symbol-name. Unlike C macros, symbols in TrEd have no other purpose than this.

Except for symbols defined by a #define directive, symbol TRED is always initially defined in TrEd, symbol BTRED is always initially defined in bTrEd. This may help to simplify sharing macro code with specific parts for TrEd and bTrEd between these two applications.