fdoc

subroutineitems_ofprivate

subroutine items_of(c, v, list)

The items of v, which is iterated over.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

vtype(value_t)in

the value

listtype(value_t)outallocatabledimension(:)

its items

Calls

Source

Show the code
subroutine items_of(c, v, list)
    type(fypp_t), intent(inout) :: c                !! the state
    type(value_t), intent(in) :: v                  !! the value
    type(value_t), allocatable, intent(out) :: list(:)  !! its items
    integer :: k

    select case (v%kind)
    case (V_LIST, V_TUPLE)
        call copy_items(v%items, list)
    case (V_DICT)
        allocate (list(size(v%items)/2))
        do k = 1, size(list)
            list(k) = v%items(2*k - 1)
        end do
    case (V_STR)
        allocate (list(len(v%text)))
        do k = 1, size(list)
            call make_string(v%text(k:k), list(k))
        end do
    case default
        call fail(c, 'a value cannot be iterated over')
    end select
end subroutine items_of

Graphs

Calls

Called by