fdoc

subroutinelookupprivate

subroutine lookup(c, id, v, found)

Find the value of name id.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)in

the state

idintegerin

the name

vtype(value_t)out

the value

foundlogicalout

false if it is not set

Source

Show the code
subroutine lookup(c, id, v, found)
    type(fypp_t), intent(in) :: c       !! the state
    integer, intent(in) :: id           !! the name
    type(value_t), intent(out) :: v     !! the value
    logical, intent(out) :: found       !! false if it is not set
    integer :: k, f

    found = .true.
    do k = c%num_bound, c%first_bound, -1
        if (c%bound(k) == id) then
            v = c%bound_values(k)
            return
        end if
    end do
    f = c%frame
    do while (f > 0)
        do k = c%frames(f)%n, 1, -1
            if (c%frames(f)%ids(k) == id) then
                v = c%frames(f)%values(k)
                return
            end if
        end do
        f = c%frames(f)%up
    end do
    found = c%is_set(id)
    if (found) v = c%globals(id)
end subroutine lookup

Graphs

Called by