Type providing an exit code and message text for exit reasons
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private | :: | code | = | 0 |
A numeric exit code used to identify the exit reason. |
|
character(len=exit_string_len), | private | :: | message | = | "No exit reason specified. Code termination may be unexpected." |
A user friendly message explaining the exit reason. |
Construct the output message describing the exit reason and return as a string
Make a string containing the error code and exit reason. This is kept minimal to make it easier for tests to parse.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self |
Ask for the exit reason output message and write to the exit_reason_unit
Write exit file containing exit code and message
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self |
Ask if this instance is identical to another passed exit_code
Determines if a passed exit_code
instance is identical
to this instance.
We could imagine providing an operator(==) overload that makes use of this but this may not be well supported by all compilers currently.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self | |||
type(exit_code), | intent(in) | :: | other |
Ask if this instance's code matches the passed value. This can
either be another exit_code
instance or an integer.
Determines if a passed exit_code
instance has the same code
as the passed integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self | |||
integer, | intent(in) | :: | code |
Determines if a passed exit_code
instance has the same code
as this instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self | |||
type(exit_code), | intent(in) | :: | other |
Determines if a passed exit_code
instance has the same code
as the passed integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self | |||
integer, | intent(in) | :: | code |
Determines if a passed exit_code
instance has the same code
as this instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(exit_code), | intent(in) | :: | self | |||
type(exit_code), | intent(in) | :: | other |
type :: exit_code
private
!> A numeric exit code used to identify the exit reason.
integer :: code = 0
!> A user friendly message explaining the exit reason.
character(len=exit_string_len) :: message = "No exit reason specified. Code termination may be unexpected."
contains
!> Construct the output message describing the exit reason and return as a string
procedure :: create_message
!> Ask for the exit reason output message and write to the [[exit_reason_unit]]
procedure :: write_exit_file
!> Ask if this instance is identical to another passed `exit_code`
procedure :: is_identical
!> Ask if this instance's code matches the passed value. This can
!> either be another `exit_code` instance or an integer.
procedure, private :: code_matches_integer
procedure, private :: code_matches_instance
generic :: code_matches => code_matches_integer, code_matches_instance
end type exit_code