Processing of define and undef preprocessor directives This module implements the core logic for handling macro definition and removal during preprocessing in the fpx Fortran preprocessor. It supports:
#define NAME value#define NAME(arg1, arg2, ...) replacement... and automatic detection#undef that removes a previously defined macroglobalundef) to block redefinitionThe routines are designed to be robust against malformed input and provide clear diagnostics when verbose = .true..
| subroutine, public handle_define | ( | character(*), intent(in) | line, |
| type(macro), dimension(:), intent(inout), allocatable | macros, | ||
| character(*), intent(in) | token ) |
Process a define directive and register or update a macro Parses the line after #define, distinguishes between object-like and function-like forms, handles variadic ..., extracts parameters correctly, and stores the macro in the active macro table. Existing macros are overwritten. Respects globalundef list – macros listed there are ignored.
| [in] | line | Full source line containing the define |
| [in,out] | macros | Current macro table (updated in-place) |
| [in] | token | Usually 'DEFINE' – keyword matched in uppercase |
Remarks
Definition at line 76 of file define.f90.
| subroutine, public handle_undef | ( | character(*), intent(in) | line, |
| type(macro), dimension(:), intent(inout), allocatable | macros, | ||
| character(*), intent(in) | token ) |
Process a undef directive and remove a macro from the table Finds the named macro in the current table and removes it. Issues a warning if the macro was not previously defined.
| [in] | line | Full source line containing the undef |
| [in,out] | macros | Current macro table (updated in-place) |
| [in] | token | Usually 'UNDEF' – keyword matched in uppercase |
Remarks
Definition at line 211 of file define.f90.