Include file handling and resolution for the fpx Fortran preprocessor.
This module implements robust and standard-compliant processing of #include directives with full support for:
The routine correctly strips quotes or angle brackets, performs path resolution, checks file existence, opens the file, and recursively invokes the main preprocessing engine on the included content using the same macro environment.
For #include "file":
For #include <file>:
Data Types | |
| interface | read_unit |
| Abstract interface for the main preprocessing routine (used for recursion) Allows handle_include to recursively call the top-level preprocess_unit routine without creating circular module dependencies. More... | |
|
private |
Get system include paths from PATH environment variable Returns an array of directory paths found in PATH.
Remarks
Definition at line 251 of file include.f90.
| recursive subroutine, public handle_include | ( | type(context), intent(in) | ctx, |
| integer, intent(in) | ounit, | ||
| procedure(read_unit) | preprocess, | ||
| type(macro), dimension(:), intent(inout), allocatable | macros, | ||
| character(*), intent(in) | token ) |
Process a include directive encountered during preprocessing Resolves the include file name (quoted or angle-bracketed), searches for the file using standard C preprocessor rules:
| [in] | ctx | Context line containing the include directive |
| [in] | ounit | Output unit where preprocessed content is written |
| [in] | preprocess | Procedure pointer to the main line-by-line preprocessor |
| [in,out] | macros | Current macro table (shared across recursion levels) |
| [in] | token | Usually 'INCLUDE' – the directive keyword |
Remarks
Definition at line 116 of file include.f90.