Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(nodeStack_t), | intent(inout) | :: | self | |||
class(node_t), | intent(in) | :: | a |
subroutine push(self,a)
class(nodeStack_t),intent(inout)::self
class(node_t),intent(in)::a
integer::k
if(self%D==self%N) then
stop 'Tried to push a full stack'
end if
do k=self%D+1,2,-1
self%levels(k) = self%levels(k-1)
end do
if(allocated(self%levels(1)%node)) deallocate(self%levels(1)%node)
allocate(self%levels(1)%node,source=a)
self%D = self%D+1
end subroutine push