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:
#include "file.h" (local/user) and #include <file.h> (system)globalincludedir)preprocess procedure pointerThe 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 238 of file include.f90.
| recursive subroutine, public handle_include | ( | character(*), intent(in) | input, |
| integer, intent(in) | ounit, | ||
| character(*), intent(in) | parent_file, | ||
| integer, intent(in) | iline, | ||
| 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] | input | Full line containing the include directive |
| [in] | ounit | Output unit where preprocessed content is written |
| [in] | parent_file | Path of the file containing the include |
| [in] | iline | Line number in parent file (for error messages) |
| [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 117 of file include.f90.