fdoc

subroutinecomparerecursiveprivate

recursive subroutine compare(c, id, v)

A chain of comparisons.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

idintegerin

the expression

vtype(value_t)out

the result

Calls

Source

Show the code
recursive subroutine compare(c, id, v)
    type(fypp_t), intent(inout) :: c    !! the state
    integer, intent(in) :: id           !! the expression
    type(value_t), intent(out) :: v     !! the result
    type(value_t) :: left, right
    integer :: k
    logical :: holds

    call evaluate(c, c%exprs(id)%a, left)
    holds = .true.
    do k = 1, size(c%exprs(id)%args)
        call evaluate(c, c%exprs(id)%args(k), right)
        if (allocated(c%error)) return
        call compare_two(c, c%exprs(id)%ops(k), left, right, holds)
        if (.not. holds) exit
        left = right
    end do
    call make_bool(holds, v)
end subroutine compare

Graphs

Calls

Called by