Extract the next token from the layout file
Each token is on a separate line. There may be multiple comments (lines beginning with #) and blank lines in between. The purpose of this subroutine is to ignore all these lines and return the next "useful" line.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | handler | |||
character(len=STRING_BUFFER_LENGTH), | intent(out) | :: | buf |
subroutine get_next_token_parallel(handler, buf)
!< Extract the next token from the layout file
!<
!< Each token is on a separate line.
!< There may be multiple comments (lines beginning with #)
!< and blank lines in between.
!< The purpose of this subroutine is to ignore all these
!< lines and return the next "useful" line.
!-----------------------------------------------------------
implicit none
integer, intent(in) :: handler
character(len=STRING_BUFFER_LENGTH), intent(out) :: buf
integer :: ios
do
!read(CONFIG_FILE_UNIT, '(A)', iostat=ios) buf
read(handler, '(A)', iostat=ios) buf
if (ios /= 0) then
print *, 'Error while reading config file.'
print *, 'Current buffer length is set to: ', &
STRING_BUFFER_LENGTH
stop
end if
if (index(buf, '#') == 1) then
! The current line begins with a hash
! Ignore it
continue
else if (len_trim(buf) == 0) then
! The current line is empty
! Ignore it
continue
else
! A new token has been found
! Break out
exit
end if
end do
end subroutine get_next_token_parallel