module s2fil_error_mod
! Uses
use s2_types_mod, only: S2_STRING_LEN
! Variables
integer, private, parameter :: S2FIL_ERROR_NUM = 16
integer, public, parameter :: S2FIL_ERROR_NONE = 0
integer, public, parameter :: S2FIL_ERROR_INIT = 1
integer, public, parameter :: S2FIL_ERROR_NOT_INIT = 2
integer, public, parameter :: S2FIL_ERROR_INIT_FAIL = 3
integer, public, parameter :: S2FIL_ERROR_SIZE_INVALID = 4
integer, public, parameter :: S2FIL_ERROR_MEM_ALLOC_FAIL = 5
integer, public, parameter :: S2FIL_ERROR_FILTER_TYPE_INVALID = 6
integer, public, parameter :: S2FIL_ERROR_SCALE_TYPE_INVALID = 7
integer, public, parameter :: S2FIL_ERROR_DIV_BY_ZERO = 8
integer, public, parameter :: S2FIL_ERROR_PROG_INPUT_INVALID = 9
integer, public, parameter :: S2FIL_ERROR_BEAM_NOT_DEF = 10
integer, public, parameter :: S2FIL_ERROR_FIL_FILE_EXISTS = 11
integer, public, parameter :: S2FIL_ERROR_FIL_FILE_INVALID = 12
integer, public, parameter :: S2FIL_ERROR_FIELD_TR_DEF = 13
integer, public, parameter :: S2FIL_ERROR_FIELD_FILE_EXISTS = 14
integer, public, parameter :: S2FIL_ERROR_FIELD_FILE_INVALID = 15
character (len=S2_STRING_LEN), private, parameter, dimension (S2FIL_ERROR_NUM) :: error_comment = (/ 'No error ', 'Object already initialised ', 'Object not initialised ', 'Object initialisation failed ', 'Sizes invalid ', 'Memory allocation failed ', 'Invalid filter type ', 'Invalid scale type ', 'Divide by zero avoided ', 'Invalid program command line option ', 'Beam not defined ', 'Filter file already exists ', 'Filter file invalid ', 'Filtered field already defined ', 'Field file already exists ', 'Field file invalid ' /)
logical, private, parameter, dimension (S2FIL_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true. /)
! Subroutines and functions
public subroutine s2fil_error (error_code, procedure, comment_add, comment_out, halt_in)
end module s2fil_error_mod
Functionality to handle errors that may occur in the S2FIL library. Public
S2FIL error codes are defined, with corresponding private error comments
and default halt execution status.
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 - January 2005
integer, private, parameter :: S2FIL_ERROR_NUM = 16
integer, public, parameter :: S2FIL_ERROR_NONE = 0
integer, public, parameter :: S2FIL_ERROR_INIT = 1
integer, public, parameter :: S2FIL_ERROR_NOT_INIT = 2
integer, public, parameter :: S2FIL_ERROR_INIT_FAIL = 3
integer, public, parameter :: S2FIL_ERROR_SIZE_INVALID = 4
integer, public, parameter :: S2FIL_ERROR_MEM_ALLOC_FAIL = 5
integer, public, parameter :: S2FIL_ERROR_FILTER_TYPE_INVALID = 6
integer, public, parameter :: S2FIL_ERROR_SCALE_TYPE_INVALID = 7
integer, public, parameter :: S2FIL_ERROR_DIV_BY_ZERO = 8
integer, public, parameter :: S2FIL_ERROR_PROG_INPUT_INVALID = 9
integer, public, parameter :: S2FIL_ERROR_BEAM_NOT_DEF = 10
integer, public, parameter :: S2FIL_ERROR_FIL_FILE_EXISTS = 11
integer, public, parameter :: S2FIL_ERROR_FIL_FILE_INVALID = 12
integer, public, parameter :: S2FIL_ERROR_FIELD_TR_DEF = 13
integer, public, parameter :: S2FIL_ERROR_FIELD_FILE_EXISTS = 14
integer, public, parameter :: S2FIL_ERROR_FIELD_FILE_INVALID = 15
character (len=S2_STRING_LEN), private, parameter, dimension (S2FIL_ERROR_NUM) :: error_comment = (/ 'No error ', 'Object already initialised ', 'Object not initialised ', 'Object initialisation failed ', 'Sizes invalid ', 'Memory allocation failed ', 'Invalid filter type ', 'Invalid scale type ', 'Divide by zero avoided ', 'Invalid program command line option ', 'Beam not defined ', 'Filter file already exists ', 'Filter file invalid ', 'Filtered field already defined ', 'Field file already exists ', 'Field file invalid ' /)Comment associated with each error type.
logical, private, parameter, dimension (S2FIL_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true. /)Default program halt status of each error type.
public subroutine s2fil_error (error_code, procedure, comment_add, comment_out, halt_in)
integer, intent(in) :: error_code
character (len=*), optional, intent(in) :: procedure
character (len=*), optional, intent(in) :: comment_add
character (len=*), optional, intent(inout) :: comment_out
logical, optional, intent(in) :: halt_in
end subroutine s2fil_error
Display error message corresponding to error_code and halt program
execution if required.
Variables:
Author: J. D. McEwen
Version: 0.2 - November 2004