fdoc

subroutinefor_directiveprivate

subroutine for_directive(c, param)

#:for names in iterable.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

paramcharacter(len=*)in

what follows the directive

Calls

Source

Show the code
subroutine for_directive(c, param)
    type(fypp_t), intent(inout) :: c            !! the state
    character(len=*), intent(in) :: param       !! what follows the directive
    integer, allocatable :: targets(:)
    integer :: at, node, expr

    call read_targets(c, param, targets, at)
    if (allocated(c%error)) return
    if (at + 2 > len(param)) then
        call fail(c, 'cannot read the loop: '//param)
        return
    end if
    if (param(at:at + 1) /= 'in' .or. .not. is_blank(param(at + 2:at + 2))) then
        call fail(c, 'cannot read the loop: '//param)
        return
    end if
    call compile(c, param(at + 2:), expr)
    node = new_node(c, N_FOR)
    c%nodes(node)%expr = expr
    c%nodes(node)%source = param
    call move_alloc(targets, c%nodes(node)%block%targets)
    call add_body(c, node, 0)
    call open_block(c, node)
end subroutine for_directive

Graphs

Calls

Called by