Append item s, growing the storage as needed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(statement_list_t), | intent(inout) | :: | self |
the item list |
||
| type(statement_t), | intent(in) | :: | s |
item to append |
subroutine push(self, s) !! Append item `s`, growing the storage as needed. class(statement_list_t), intent(inout) :: self !! the item list type(statement_t), intent(in) :: s !! item to append type(statement_t), allocatable :: tmp(:) if (.not. allocated(self%s)) allocate (self%s(64)) if (self%n == size(self%s)) then allocate (tmp(2*self%n)) tmp(1:self%n) = self%s(1:self%n) call move_alloc(tmp, self%s) end if self%n = self%n + 1 self%s(self%n) = s end subroutine push