subroutine read_gmsh_msh1_number_of_items(file_unit, item_name, text_line, number_of_items, status, flag)
integer, intent(in) :: file_unit
character(len=*), intent(in) :: item_name
character(len=*), intent(inout) :: text_line
integer, intent(out) :: number_of_items
type(gmsh_msh1_status_type), intent(inout) :: status
logical, intent(out) :: flag
character(1) :: dummy
read( &!
unit = file_unit , &!
fmt = '(A)' , &!
iostat = status%io%code , &!
iomsg = status%io%msg(:) &!
) &!
text_line(:)
if ( is_iostat_failure(status) ) then
status%err%code = status%io%code
status%err%msg(:) = status%io%msg(:)
return
end if
read( &!
unit = text_line(:) , &!
fmt = * , &!
iostat = status%io%code , &!
iomsg = status%io%msg(:) &!
) &!
number_of_items, dummy
if ( is_iostat_success(status) ) then
write( &!
unit = status%err%msg(:) , &!
fmt = '(3A)' &!
) &!
'Extra data was detected while reading `' , &!
item_name , &!
'`.'
return
end if
read( &!
unit = text_line(:) , &!
fmt = * , &!
iostat = status%io%code , &!
iomsg = status%io%msg(:) &!
) &!
number_of_items
if ( is_iostat_failure(status) ) then
status%err%code = status%io%code
status%err%msg(:) = status%io%msg(:)
return
end if
if (number_of_items .lt. 0) then
write( &!
unit = status%err%msg(:) , &!
fmt = '(2(A,1X),I0,1X,A)' &!
) &!
'The number of' , &!
item_name , &!
number_of_items , &!
'must be greater than -1.'
return
end if
flag = .true.
end subroutine read_gmsh_msh1_number_of_items