diff options
Diffstat (limited to '')
-rw-r--r-- | pkg/pointer/stack-stack.go (renamed from pkg/stack/stack-stack.go) | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pkg/stack/stack-stack.go b/pkg/pointer/stack-stack.go index 9b80079..6d22f51 100644 --- a/pkg/stack/stack-stack.go +++ b/pkg/pointer/stack-stack.go @@ -1,8 +1,4 @@ -package stack - -import ( - "git.adyxax.org/adyxax/gofunge/pkg/pointer" -) +package pointer type StackStack struct { head *Stack @@ -16,7 +12,7 @@ func NewStackStack() *StackStack { } } -func (ss *StackStack) Begin(p *pointer.Pointer) { +func (ss *StackStack) Begin(p *Pointer) { ss.height++ soss := ss.head n := soss.Pop() @@ -44,7 +40,7 @@ func (ss *StackStack) Begin(p *pointer.Pointer) { p.CalculateNewStorageOffset() } -func (ss *StackStack) End(p *pointer.Pointer) (reflect bool) { +func (ss *StackStack) End(p *Pointer) (reflect bool) { if ss.height == 1 { return true } @@ -89,3 +85,11 @@ func (ss *StackStack) Under() (reflect bool) { } return false } + +func (ss StackStack) Pop() int { + return ss.head.Pop() +} + +func (ss StackStack) Push(v int) { + ss.head.Push(v) +} |