fdoc

functionfold_positionpureprivate

pure integer function fold_position(line, first, last) result(at)

Where to end the part of line after first, at most at last. Positions count from 0.

Arguments

NameTypeIntentAttributesDescription
linecharacter(len=*)in

the line

firstintegerin

where the part starts

lastintegerin

where it could end

Result

NameTypeAttributesDescription
atinteger

Source

Show the code
pure integer function fold_position(line, first, last) result(at)
    character(len=*), intent(in) :: line    !! the line
    integer, intent(in) :: first            !! where the part starts
    integer, intent(in) :: last             !! where it could end
    integer :: blank

    at = last
    blank = index(line(first + 1:last), ' ', back=.true.)
    if (blank == 0) return
    blank = first + blank - 1
    if (blank >= first + (2*(last - first))/3) at = blank
end function fold_position

Graphs

Called by