36b3af2e3d
PR Check / Code Quality: Format (push) Failing after 1s
PR Check / Code Quality: Lint (darwin) (push) Failing after 0s
PR Check / Code Quality: Lint (freebsd) (push) Failing after 1s
PR Check / Code Quality: Lint (windows) (push) Failing after 1s
PR Check / Code Quality: Lint (linux) (push) Failing after 1s
PR Check / Security: Vulnerability Scan (push) Failing after 0s
Update Documentation / update-docs (push) Failing after 2s
PR Check / Code Quality: Vendor (push) Failing after 1s
PR Check / Code Quality: Coverage (push) Failing after 0s
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
49 lines
661 B
Go
49 lines
661 B
Go
package terminfo
|
|
|
|
type stack []interface{}
|
|
|
|
func (s *stack) push(v interface{}) {
|
|
*s = append(*s, v)
|
|
}
|
|
|
|
func (s *stack) pop() interface{} {
|
|
if len(*s) == 0 {
|
|
return nil
|
|
}
|
|
v := (*s)[len(*s)-1]
|
|
*s = (*s)[:len(*s)-1]
|
|
return v
|
|
}
|
|
|
|
func (s *stack) popInt() int {
|
|
if i, ok := s.pop().(int); ok {
|
|
return i
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (s *stack) popBool() bool {
|
|
if b, ok := s.pop().(bool); ok {
|
|
return b
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (s *stack) popByte() byte {
|
|
if b, ok := s.pop().(byte); ok {
|
|
return b
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (s *stack) popString() string {
|
|
if a, ok := s.pop().(string); ok {
|
|
return a
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (s *stack) reset() {
|
|
*s = (*s)[:0]
|
|
}
|