Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved support for NAG #418

Merged
merged 7 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/stdlib_logger.f90
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ subroutine add_log_unit( self, unit, stat )
integer :: lun
character(12) :: specifier
logical :: question
integer :: istat
character(len=80) :: msgtxt
awvwgk marked this conversation as resolved.
Show resolved Hide resolved

call validate_unit()
if ( present(stat) ) then
Expand Down Expand Up @@ -350,7 +352,8 @@ subroutine validate_unit()
end if

! Check that unit is opened
inquire( unit, opened=question )
inquire( unit, opened=question, iostat=istat, iomsg=msgtxt)
if(istat/=0) question=.false.
sakamoti marked this conversation as resolved.
Show resolved Hide resolved
if ( .not. question ) then
if ( present(stat) ) then
stat = unopened_in_error
Expand Down
67 changes: 47 additions & 20 deletions src/stdlib_string_type.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ contains
type(string_type), intent(in) :: string
integer :: ich

ich = merge(ichar(string%raw), 0, allocated(string%raw))
ich = merge(ichar(string%raw(1:1)), 0, allocated(string%raw))
awvwgk marked this conversation as resolved.
Show resolved Hide resolved

end function ichar_string

Expand All @@ -431,7 +431,7 @@ contains
type(string_type), intent(in) :: string
integer :: ich

ich = merge(iachar(string%raw), 0, allocated(string%raw))
ich = merge(iachar(string%raw(1:1)), 0, allocated(string%raw))
awvwgk marked this conversation as resolved.
Show resolved Hide resolved

end function iachar_string

Expand Down Expand Up @@ -571,8 +571,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = index(maybe(string), maybe(substring), &
merge(back, .false., present(back)))
if(present(back))then
pos = index(maybe(string), maybe(substring),back)
else
pos = index(maybe(string), maybe(substring),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function index_string_string

Expand All @@ -584,8 +587,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = index(maybe(string), substring, &
merge(back, .false., present(back)))
if(present(back))then
pos = index(maybe(string), substring,back)
else
pos = index(maybe(string), substring,.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function index_string_char

Expand All @@ -597,8 +603,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = index(string, maybe(substring), &
merge(back, .false., present(back)))
if(present(back))then
pos = index(string, maybe(substring),back)
else
pos = index(string, maybe(substring),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function index_char_string

Expand All @@ -612,8 +621,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = scan(maybe(string), maybe(set), &
merge(back, .false., present(back)))
if(present(back))then
pos = scan(maybe(string), maybe(set),back)
else
pos = scan(maybe(string), maybe(set),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function scan_string_string

Expand All @@ -625,8 +637,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = scan(maybe(string), set, &
merge(back, .false., present(back)))
if(present(back))then
pos = scan(maybe(string), set,back)
else
pos = scan(maybe(string), set,.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function scan_string_char

Expand All @@ -638,8 +653,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = scan(string, maybe(set), &
merge(back, .false., present(back)))
if(present(back))then
pos = scan(string, maybe(set),back)
else
pos = scan(string, maybe(set),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function scan_char_string

Expand All @@ -653,8 +671,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = verify(maybe(string), maybe(set), &
merge(back, .false., present(back)))
if(present(back))then
pos = verify(maybe(string), maybe(set),back)
else
pos = verify(maybe(string), maybe(set),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function verify_string_string

Expand All @@ -667,8 +688,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = verify(maybe(string), set, &
merge(back, .false., present(back)))
if(present(back))then
pos = verify(maybe(string), set,back)
else
pos = verify(maybe(string), set,.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function verify_string_char

Expand All @@ -681,8 +705,11 @@ contains
logical, intent(in), optional :: back
integer :: pos

pos = verify(string, maybe(set), &
merge(back, .false., present(back)))
if(present(back))then
pos = verify(string, maybe(set),back)
else
pos = verify(string, maybe(set),.false.)
endif
sakamoti marked this conversation as resolved.
Show resolved Hide resolved

end function verify_char_string

Expand Down
5 changes: 4 additions & 1 deletion src/tests/logger/test_stdlib_logger.f90
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ end subroutine test_adding_log_files
subroutine test_removing_log_units()

logical :: opened
integer :: istat
character(len=80) :: msgtxt
awvwgk marked this conversation as resolved.
Show resolved Hide resolved

print *
print *, 'running test_removing_log_units'
Expand Down Expand Up @@ -462,7 +464,8 @@ subroutine test_removing_log_units()

end if

inquire( unit4, opened=opened )
inquire( unit4, opened=opened ,iostat=istat,iomsg=msgtxt)
if(istat/=0) opened=.false.
sakamoti marked this conversation as resolved.
Show resolved Hide resolved
if ( opened ) then
error stop 'UNIT4 is opened contrary to expectations.'

Expand Down
2 changes: 1 addition & 1 deletion src/tests/stats/test_mean_f03.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ program test_mean
call check( sum( abs( mean(d,2) - sum(d,2)/real(size(d,2), dp) )) < dptol)

!dp rank 8
allocate(d8(size(d,1), size(d,2), 3, 4, 5, 6, 7, 8))
allocate(d8(size(d,1), size(d,2), 3, 4, 5, 6, 7, 8),source=0.0_dp)
sakamoti marked this conversation as resolved.
Show resolved Hide resolved
d8(:, :, 1, 4, 5 ,6 ,7 ,8)=d;
d8(:, :, 2, 4, 5 ,6 ,7 ,8)=d * 1.5_dp;
d8(:, :, 3, 4, 5 ,6 ,7 ,8)=d * 4._dp;
Expand Down