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:
The routines are designed to be robust against malformed input and provide clear diagnostics when verbose = .true..
| subroutine, public handle_define | ( | type(context), intent(in) | ctx, |
| 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] | ctx | Context source line containing the define |
| [in,out] | macros | Current macro table (updated in-place) |
| [in] | token | Usually 'DEFINE' – keyword matched in lowercase |
Remarks
Definition at line 77 of file define.f90.
| subroutine, public handle_undef | ( | type(context), intent(in) | ctx, |
| 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] | ctx | Context source line containing the undef |
| [in,out] | macros | Current macro table (updated in-place) |
| [in] | token | Usually 'UNDEF' – keyword matched in lowercase |
Remarks
Definition at line 207 of file define.f90.