Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | value |
value to use on STOP |
||
character(len=*), | intent(in) | :: | message |
Error message |
subroutine fpm_stop(value,message)
! TODO: if verbose mode, call ERROR STOP instead of STOP
! TODO: if M_escape is used, add color
! to work with older compilers might need a case statement for values
!> value to use on STOP
integer, intent(in) :: value
!> Error message
character(len=*), intent(in) :: message
integer :: iostat
if(message/='')then
flush(unit=stderr,iostat=iostat)
flush(unit=stdout,iostat=iostat)
if(value>0)then
write(stderr,'("<ERROR> ",a)')trim(message)
else
write(stderr,'("<INFO> ",a)')trim(message)
endif
flush(unit=stderr,iostat=iostat)
endif
stop value
end subroutine fpm_stop