Skip to content

Commit

Permalink
Alexei's workaround for an ifort18 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrueger committed Jan 22, 2020
1 parent 8f7187d commit 17b497f
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/ftlString.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,16 @@ elemental type(ftlString) function StripString(self, chars) result(stripped)
class(ftlString), intent(in) :: self
type(ftlString), intent(in) :: chars

stripped = self%StripRaw(chars%raw)
integer :: first, last

first = verify(self%raw, chars%raw)
last = verify(self%raw, chars%raw, .true.)

if (first == 0) then
stripped%raw = ''
else
stripped%raw = self%raw(first:last)
endif

end function

Expand Down Expand Up @@ -1724,7 +1733,10 @@ elemental type(ftlString) function RStripString(self, chars) result(stripped)
class(ftlString), intent(in) :: self
type(ftlString), intent(in) :: chars

stripped = self%RStripRaw(chars%raw)
integer :: last

last = verify(self%raw, chars%raw, .true.)
stripped%raw = self%raw(1:last)

end function

Expand Down Expand Up @@ -1768,7 +1780,15 @@ elemental type(ftlString) function LStripString(self, chars) result(stripped)
class(ftlString), intent(in) :: self
type(ftlString), intent(in) :: chars

stripped = self%LStripRaw(chars%raw)
integer :: first

first = verify(self%raw, chars%raw)

if (first == 0) then
stripped%raw = ''
else
stripped%raw = self%raw(first:)
endif

end function

Expand Down Expand Up @@ -1818,7 +1838,7 @@ elemental type(ftlString) function Upper(self)

integer :: idx, ascii

Upper = self
Upper%raw = self%raw
do idx = 1, len(Upper%raw)
ascii = iachar(Upper%raw(idx:idx))
if (ascii >= 97 .and. ascii <= 122) Upper%raw(idx:idx) = achar(ascii-32)
Expand All @@ -1831,7 +1851,7 @@ elemental type(ftlString) function Lower(self)

integer :: idx, ascii

Lower = self
Lower%raw = self%raw
do idx = 1, len(Lower%raw)
ascii = iachar(Lower%raw(idx:idx))
if (ascii >= 65 .and. ascii <= 90) Lower%raw(idx:idx) = achar(ascii+32)
Expand Down

0 comments on commit 17b497f

Please sign in to comment.