fdoc

functionnew_nodeprivate

integer function new_node(c, kind) result(id)

A new node.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

kindintegerin

what it is

Result

NameTypeAttributesDescription
idinteger

Calls

Source

Show the code
integer function new_node(c, kind) result(id)
    type(fypp_t), intent(inout) :: c    !! the state
    integer, intent(in) :: kind         !! what it is
    type(node_t), allocatable :: grown(:)
    integer :: k

    if (c%num_nodes == size(c%nodes)) then
        allocate (grown(2*c%num_nodes))
        do k = 1, c%num_nodes
            call move_node(c%nodes(k), grown(k))
        end do
        call move_alloc(grown, c%nodes)
    end if
    c%num_nodes = c%num_nodes + 1
    id = c%num_nodes
    c%nodes(id)%kind = kind
    if (kind /= N_TEXT .and. kind /= N_EVAL) allocate (c%nodes(id)%block)
end function new_node

Graphs

Calls

Called by