invoke_unary Subroutine

subroutine invoke_unary(action)

Arguments

Type IntentOptional Attributes Name
procedure(unary_f), intent(in), pointer :: action

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
logical, public :: is_cart
type(rpn_t), public :: z

Source Code

    subroutine invoke_unary(action)
        procedure(unary_f), pointer, intent(in) :: action
        logical :: is_cart
        type(rpn_t) :: z
        if (complex_mode) then
            z = stack%peek(1)
            is_cart = z%is_cartesian()
            if (.not. is_cart) then
                z = to_cartesian(z)
            end if
            z = action(z)
            if (.not. is_cart) then
                z = to_polar(z)
            end if
            call stack%set(z)
        else
            call stack%set(action(stack%peek(1)))
        end if
    end subroutine invoke_unary