fdoc

subroutinefind_hash_headerpureprivate

pure subroutine find_hash_header(block, at, stop_at)

Find the first # header line of block.

Arguments

NameTypeIntentAttributesDescription
blockcharacter(len=*)in

the chunk

atintegerout

where it starts, or 0

stop_atintegerout

where it ends, before its line feed

Source

Show the code
pure subroutine find_hash_header(block, at, stop_at)
    character(len=*), intent(in) :: block   !! the chunk
    integer, intent(out) :: at              !! where it starts, or 0
    integer, intent(out) :: stop_at         !! where it ends, before its line feed
    integer :: i, j

    at = 0
    stop_at = 0
    i = 1
    do while (i <= len(block))
        if (block(i:i) == '#') then
            at = i
            j = index(block(i:), NL)
            stop_at = merge(len(block), i + j - 2, j == 0)
            return
        end if
        j = index(block(i:), NL)
        if (j == 0) return
        i = i + j
    end do
end subroutine find_hash_header

Graphs

Called by