fdoc

subroutineassign_targetsprivate

subroutine assign_targets(c, targets, v)

Set the variables targets to v, unpacking it if there are several.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

targetsintegerindimension(:)

the names

vtype(value_t)in

the value

Calls

Source

Show the code
subroutine assign_targets(c, targets, v)
    type(fypp_t), intent(inout) :: c    !! the state
    integer, intent(in) :: targets(:)   !! the names
    type(value_t), intent(in) :: v      !! the value
    integer :: k

    if (size(targets) == 1) then
        call define(c, targets(1), v)
    else if (v%kind /= V_LIST .and. v%kind /= V_TUPLE) then
        call fail(c, 'a value cannot be unpacked')
    else if (size(v%items) /= size(targets)) then
        call fail(c, 'a value has the wrong number of items to unpack')
    else
        do k = 1, size(targets)
            call define(c, targets(k), v%items(k))
        end do
    end if
end subroutine assign_targets

Graphs

Calls

Called by