aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-09-30 09:30:12 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-09-30 09:30:12 +0200
commitff86e0ee5bf9cafdea3e656fcae10a78f3c9d182 (patch)
treec460855f98eefd207d6c36791839df4c53a98811
parentf6ed88c61de57c5367ccd8c3b513e327be992fbd (diff)
downloadmendeleev-ff86e0ee5bf9cafdea3e656fcae10a78f3c9d182.tar.gz
Fortran: finish first formula before others
-rw-r--r--mendeleev.f9019
1 files changed, 9 insertions, 10 deletions
diff --git a/mendeleev.f90 b/mendeleev.f90
index 5abe2a4..f77e723 100644
--- a/mendeleev.f90
+++ b/mendeleev.f90
@@ -118,14 +118,15 @@ contains
end subroutine search
- pure subroutine advance(word, f)
+ pure subroutine advance(word, formula)
character(len=*), intent(in) :: word
- type(formula_t), pointer, intent(in out) :: f
+ type(formula_t), pointer, intent(in out) :: formula
integer :: n, tail
integer :: start, length, sh, c
- type(formula_t), pointer :: g
+ type(formula_t), pointer :: f, g
+ f => formula
tail = f%tail
n = f%n
@@ -176,14 +177,12 @@ contains
allocate(formula)
allocate(formula%elements(len(word)))
- do while (formula%tail <= len(word))
- f => formula
- do while (associated(f))
- if (f%tail <= len(word)) then
- call advance(word, f)
- end if
- f => f%next
+ f => formula
+ do while (associated(f))
+ do while (f%tail <= len(word))
+ call advance(word, f)
end do
+ f => f%next
end do
end function explode
end program mendeleev