debug Derived Type

type, public :: debug


Inherited by

type~~debug~~InheritedByGraph type~debug debug type~my_type my_type type~my_type->type~debug err

Components

Type Visibility Attributes Name Initial
logical, public :: ok = .true.

.true. means no error/warning/info

character(len=MAX_LENGTH_CATEGORY), private :: category

category of error/warning/info

integer, private :: code = NONE

error/warning/info code, 0=none

logical, private :: dbg = DEBUG_MODE

debug mode flag

character(len=MAX_LENGTH_LOCATION), private :: location

location of error/warning/info

character(len=MAX_LENGTH_MESSAGE), private :: message

message of error/warning/info

integer, private :: severity = NONE

severity of the error, 0=none, 1=error, 2=warning, 3=info

character(len=MAX_LENGTH_SUGGESTION), private :: suggestion

suggestion for error/warning/info


Type-Bound Procedures

procedure, public :: print => print_error

  • private impure subroutine print_error(this)

    Author
    Seyed Ali Ghasemi
    License
    BSD 3-Clause

    Arguments

    Type IntentOptional Attributes Name
    class(debug), intent(in) :: this

procedure, public :: reset

  • private pure elemental subroutine reset(this)

    Author
    Seyed Ali Ghasemi
    License
    BSD 3-Clause

    Arguments

    Type IntentOptional Attributes Name
    class(debug), intent(inout) :: this

procedure, public :: set

  • private pure elemental subroutine set(this, severity, code, category, message, location, suggestion)

    Author
    Seyed Ali Ghasemi
    License
    BSD 3-Clause

    Arguments

    Type IntentOptional Attributes Name
    class(debug), intent(inout) :: this
    integer, intent(in) :: severity
    integer, intent(in) :: code
    character(len=*), intent(in) :: category
    character(len=*), intent(in) :: message
    character(len=*), intent(in) :: location
    character(len=*), intent(in) :: suggestion

Source Code

   type debug
      logical, private :: dbg = DEBUG_MODE                  !! debug mode flag
      logical :: ok = .true.                                  !! .true. means no error/warning/info
      integer, private :: code = NONE                         !! error/warning/info code, 0=none
      integer, private :: severity = NONE                     !! severity of the error, 0=none, 1=error, 2=warning, 3=info
      character(MAX_LENGTH_CATEGORY), private :: category     !! category of error/warning/info
      character(MAX_LENGTH_LOCATION), private :: location     !! location of error/warning/info
      character(MAX_LENGTH_MESSAGE), private :: message       !! message of error/warning/info
      character(MAX_LENGTH_SUGGESTION), private :: suggestion !! suggestion for error/warning/info
   contains
      procedure :: set
      procedure :: print => print_error
      procedure :: reset
   end type debug