Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
procedure(unary_f), | intent(in), | pointer | :: | action |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | is_cart | ||||
type(rpn_t), | public | :: | z |
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