True if a code line of text may be longer than limit characters (see longest_code).
A line has no more characters than bytes, so the scan is only needed when a line has more
bytes than that, which finding the line breaks shows quickly.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | text |
the formatted text |
||
| integer, | intent(in) | :: | limit |
the line length |
pure logical function too_long(text, limit) !! True if a code line of `text` may be longer than `limit` characters (see [[longest_code]]). !! A line has no more characters than bytes, so the scan is only needed when a line has more !! bytes than that, which finding the line breaks shows quickly. character(len=*), intent(in) :: text !! the formatted text integer, intent(in) :: limit !! the line length integer :: p, q too_long = .false. p = 1 do while (p <= len(text)) q = index(text(p:), achar(10)) if (q == 0) q = len(text) - p + 2 if (q - 1 > limit) then too_long = longest_code(text) > limit return end if p = p + q end do end function too_long