terminal Derived Type

type, public :: terminal


Contents

Source Code


Type-Bound Procedures

procedure, public, :: setup => set_terminal

  • private subroutine set_terminal(self)

    设置终端输出

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(out) :: self

procedure, public, :: progress_bar => terminal_progress_bar

  • private subroutine terminal_progress_bar(self, msg, p)

    进度条

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg
    real, intent(in) :: p

procedure, public, :: info => terminal_info

  • private subroutine terminal_info(self, msg)

    信息

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

procedure, public, :: warning => terminal_warning

  • private subroutine terminal_warning(self, msg)

    警告

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

procedure, public, :: error => terminal_error

  • private subroutine terminal_error(self, msg)

    错误

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

procedure, public, :: success => terminal_success

  • private subroutine terminal_success(self, msg)

    成功

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

procedure, public, :: red

  • private pure function red(self, msg)

    红色

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

    Return Value character(len=:), allocatable

procedure, public, :: yellow

  • private pure function yellow(self, msg)

    黄色

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

    Return Value character(len=:), allocatable

procedure, public, :: green

  • private pure function green(self, msg)

    绿色

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

    Return Value character(len=:), allocatable

procedure, public, :: blue

  • private pure function blue(self, msg)

    蓝色

    Arguments

    Type IntentOptional Attributes Name
    class(terminal), intent(in) :: self
    character(len=*), intent(in) :: msg

    Return Value character(len=:), allocatable

Source Code

    type terminal
        logical, private :: use_color = .false.
    contains
        procedure :: setup => set_terminal
        procedure :: progress_bar => terminal_progress_bar
        procedure :: info => terminal_info
        procedure :: warning => terminal_warning
        procedure :: error => terminal_error
        procedure :: success => terminal_success
        procedure :: blue, green, yellow, red
    end type terminal