subroutineitems_ofprivate
subroutine items_of(c, v, list)
The items of v, which is iterated over.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| v | type(value_t) | in | the value | |
| list | type(value_t) | out | allocatabledimension(:) | 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