pending_t Derived Type

type, public :: pending_t

Bytes of an escape sequence that arrived without their continuation.

A terminal is free to split ESC [ A across two reads, and a decoder that forgot the ESC between calls would report a stray escape and then the letter A. This carries the fragment across.


Components

Type Visibility Attributes Name Initial
character(len=PENDING_CAPACITY), private :: buffer = ""

Fixed store, so a pending_t needs no allocation and can be a plain component of a caller’s state.

integer(kind=default_int), private :: length = 0_default_int

Bytes in use.


Type-Bound Procedures

procedure, public :: clear => pending_clear

  • private pure subroutine pending_clear(this)

    Forget any partial escape sequence.

    Arguments

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

procedure, public :: is_empty => pending_is_empty

  • private pure function pending_is_empty(this) result(r)

    Whether a partial sequence is being carried.

    Arguments

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

    Return Value logical

Source Code

   type :: pending_t
      !! Bytes of an escape sequence that arrived without their continuation.
      !!
      !! A terminal is free to split `ESC [ A` across two reads, and a decoder
      !! that forgot the `ESC` between calls would report a stray escape and
      !! then the letter A. This carries the fragment across.
      private
      character(len=PENDING_CAPACITY) :: buffer = ""
         !! Fixed store, so a `pending_t` needs no allocation and can be a
         !! plain component of a caller's state.
      integer(default_int) :: length = 0_default_int
         !! Bytes in use.
   contains
      procedure :: clear => pending_clear
      procedure :: is_empty => pending_is_empty
   end type pending_t