search for global tags can stop once first section is found
This commit is contained in:
parent
cbd59fc781
commit
bf43156112
27
src/IO.f90
27
src/IO.f90
|
@ -900,10 +900,10 @@ function IO_spotTagInPart(fileUnit,part,tag,Nsections)
|
||||||
do while (trim(line) /= IO_EOF)
|
do while (trim(line) /= IO_EOF)
|
||||||
line = IO_read(fileUnit)
|
line = IO_read(fileUnit)
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
foundNextPart: if (IO_getTag(line,'<','>') /= '') then
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||||
exit
|
exit
|
||||||
endif
|
endif foundNextPart
|
||||||
if (IO_getTag(line,'[',']') /= '') section = section + 1_pInt ! found [section] identifier
|
if (IO_getTag(line,'[',']') /= '') section = section + 1_pInt ! found [section] identifier
|
||||||
if (section > 0_pInt) then
|
if (section > 0_pInt) then
|
||||||
chunkPos = IO_stringPos(line)
|
chunkPos = IO_stringPos(line)
|
||||||
|
@ -925,13 +925,10 @@ logical function IO_globalTagInPart(fileUnit,part,tag)
|
||||||
character(len=*),intent(in) :: part, & !< part in which tag is searched for
|
character(len=*),intent(in) :: part, & !< part in which tag is searched for
|
||||||
tag !< tag to search for
|
tag !< tag to search for
|
||||||
|
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
integer(pInt), allocatable, dimension(:) :: chunkPos
|
||||||
integer(pInt) :: section
|
|
||||||
character(len=65536) :: line
|
character(len=65536) :: line
|
||||||
|
|
||||||
IO_globalTagInPart = .false. ! assume to nowhere spot tag
|
IO_globalTagInPart = .false. ! assume to nowhere spot tag
|
||||||
section = 0_pInt
|
|
||||||
line =''
|
line =''
|
||||||
|
|
||||||
rewind(fileUnit)
|
rewind(fileUnit)
|
||||||
|
@ -942,16 +939,20 @@ logical function IO_globalTagInPart(fileUnit,part,tag)
|
||||||
do while (trim(line) /= IO_EOF)
|
do while (trim(line) /= IO_EOF)
|
||||||
line = IO_read(fileUnit)
|
line = IO_read(fileUnit)
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
foundNextPart: if (IO_getTag(line,'<','>') /= '') then
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||||
exit
|
exit
|
||||||
endif
|
endif foundNextPart
|
||||||
if (IO_getTag(line,'[',']') /= '') section = section + 1_pInt ! found [section] identifier
|
foundFirstSection: if (IO_getTag(line,'[',']') /= '') then
|
||||||
if (section == 0_pInt) then
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||||
chunkPos = IO_stringPos(line)
|
exit
|
||||||
if (tag == trim(IO_lc(IO_stringValue(line,chunkPos,1_pInt)))) & ! match
|
endif foundFirstSection
|
||||||
IO_globalTagInPart = .true.
|
chunkPos = IO_stringPos(line)
|
||||||
endif
|
match: if (tag == trim(IO_lc(IO_stringValue(line,chunkPos,1_pInt)))) then
|
||||||
|
IO_globalTagInPart = .true.
|
||||||
|
line = IO_read(fileUnit, .true.) ! reset IO_read
|
||||||
|
exit
|
||||||
|
endif match
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end function IO_globalTagInPart
|
end function IO_globalTagInPart
|
||||||
|
|
Loading…
Reference in New Issue