面行に含まれる頂点トークン数を数え、扇形分割時の三角形数算出に使う。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
|
integer(i32) pure function count_face_tokens(line) character(len=*), intent(in) :: line character(len=1024) :: s integer :: pos, n, i s = trim(adjustl(line)) pos = 3 n = len_trim(s) count_face_tokens = 0 do while (pos <= n) do while (pos <= n .and. s(pos:pos) == ' ') pos = pos + 1 end do if (pos > n) exit count_face_tokens = count_face_tokens + 1 do i = pos, n if (s(i:i) == ' ') then pos = i + 1 exit end if if (i == n) pos = n + 1 end do end do end function count_face_tokens