fdoc

subroutinepush_backprivate

subroutine push_back(stack, n, text)

Put text back on the stack of chunks.

Arguments

NameTypeIntentAttributesDescription
stacktype(string_t)inoutallocatabledimension(:)

the chunks, the next one last

nintegerinout

how many there are

textcharacter(len=*)in

the chunk

Source

Show the code
subroutine push_back(stack, n, text)
    type(string_t), allocatable, intent(inout) :: stack(:)  !! the chunks, the next one last
    integer, intent(inout) :: n                             !! how many there are
    character(len=*), intent(in) :: text                    !! the chunk
    type(string_t), allocatable :: grown(:)
    integer :: k

    if (n == size(stack)) then
        allocate (grown(2*n + 4))
        do k = 1, n
            call move_alloc(stack(k)%s, grown(k)%s)
        end do
        call move_alloc(grown, stack)
    end if
    n = n + 1
    stack(n)%s = text
end subroutine push_back

Graphs

Called by