Open construct sc, growing the storage as needed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(scope_stack_t), | intent(inout) | :: | self |
the stack |
||
| type(scope_t), | intent(in) | :: | sc |
the construct to open |
pure subroutine stack_push(self, sc) !! Open construct `sc`, growing the storage as needed. class(scope_stack_t), intent(inout) :: self !! the stack type(scope_t), intent(in) :: sc !! the construct to open type(scope_t), allocatable :: tmp(:) if (.not. allocated(self%s)) allocate (self%s(16)) if (self%top == size(self%s)) then allocate (tmp(2*self%top)) tmp(1:self%top) = self%s(1:self%top) call move_alloc(tmp, self%s) end if self%top = self%top + 1 self%s(self%top) = sc end subroutine stack_push