subroutinecomparerecursiveprivate
recursive subroutine compare(c, id, v)
A chain of comparisons.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| id | integer | in | the expression | |
| v | type(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