The #if and #elif directives require an argument.
The balance of the line is first tokenised by the standard Felix tokeniser and thus may contain Felix literals and Felix identifiers.
The line is then expanded by macro substitution. The result is then parsed as an expression and constant folded and must yield a boolean constant. Note that every name encountered must name a preprocessor macro.
1: #line 123 "./lpsrc/flx_tut_macro.pak" 2: #import <flx.flxh> 3: print "Defining FIRST"; endl; 4: #define FIRST 5: #ifdef FIRST 6: print "detected FIRST"; endl; 7: #else 8: print "BAD"; endl; 9: #endif
1: Defining FIRST 2: detected FIRST
1: #line 139 "./lpsrc/flx_tut_macro.pak" 2: #import <flx.flxh> 3: #define FIRST 1 4: #define SECOND 2 5: #if FIRST == 1 and SECOND == 2 6: print "OK"; endl; 7: #else 8: print "BAD"; endl; 9: #endif
1: OK
1: #line 154 "./lpsrc/flx_tut_macro.pak" 2: #import <flx.flxh> 3: #define FIRST 1 4: #define SECOND 2 5: #if if FIRST == 1 then SECOND == 2 else 1 == 0 endif 6: print "OK"; endl; 7: #else 8: print "BAD"; endl; 9: #endif
1: OK
1: #line 177 "./lpsrc/flx_tut_macro.pak" 2: #import <flx.flxh> 3: #import "mac-1.02.02-3.flx" 4: #ifdef FIRST 5: print "OK"; 6: #else 7: print "BAD"; 8: #endif 9: endl;
1: OK