fdoc

subroutineinclude_directiverecursiveprivate

recursive subroutine include_directive(c, param, path)

#:include "file".

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

paramcharacter(len=*)in

what follows the directive

pathcharacter(len=*)in

the file holding the directive

Calls

Source

Show the code
recursive subroutine include_directive(c, param, path)
    type(fypp_t), intent(inout) :: c            !! the state
    character(len=*), intent(in) :: param       !! what follows the directive
    character(len=*), intent(in) :: path        !! the file holding the directive
    character(len=:), allocatable :: name, candidate
    logical :: exists
    integer :: k, slash

    if (len(param) < 2) then
        call fail(c, 'cannot read the include: '//param)
        return
    end if
    name = param(2:len(param) - 1)
    slash = last_separator(path)
    candidate = path(:slash)//name
    !$omp critical (file_io)
    inquire (file=candidate, exist=exists)
    k = 0
    do while (.not. exists .and. k < size(c%includes))
        k = k + 1
        candidate = c%includes(k)%s//'/'//name
        inquire (file=candidate, exist=exists)
    end do
    !$omp end critical (file_io)
    if (exists) then
        call parse_file(c, candidate)
    else
        call fail(c, 'cannot find the include file '//name)
    end if
end subroutine include_directive

Graphs

Calls

Called by