//  Pops frame off front of message and returns it as 'head'
//  If next frame is empty, pops that empty frame.
//  Return remaining frames of message as 'tail'
968629
func unwrap(msg []string) (head string, tail []string) {
	head = msg[0]
	if len(msg) > 1 && msg[1] == "" {
		tail = msg[2:]
	} else {
		tail = msg[1:]
	}
	return
}
33502
func (s *sccAcct) pop() Vertex {
	n := len(s.Stack)
	if n == 0 {
		return nil
	}
	vertex := s.Stack[n-1]
	s.Stack = s.Stack[:n-1]
	return vertex
}
157275
func (channel MessageQueue) PopWithTimeout(maxDuration time.Duration) (*Message, bool) {
	timeout := time.NewTimer(maxDuration)
	select {
	case msg, more := <-channel:
		timeout.Stop()
		return msg, more
	case <-timeout.C:
		return nil, false
	}
}
1355269
func Message(err error) string {
	if tail, ok := err.(errLinkedList); ok {
		return tail.Head().Error()
	}
	if hasMsg, ok := err.(hasMessage); ok {
		return hasMsg.Message()
	}
	return err.Error()
}
95539
func (ms *MatStack) Pop() error {
	if len(*ms) == 1 {
		return errors.New("Cannot pop from mat stack, at minimum stack length of 1")
	}
	(*ms) = (*ms)[:len(*ms)-1]

	return nil
}
513682
func (s *SliceStack) Pop() (interface{}, error) {
	if s.IsEmpty() {
		return nil, errors.New("unable to pop element, stack is empty")
	}

	s.size--
	item := s.backing[s.size]
	s.backing = s.backing[0:s.size]
	return item, nil
}
561405
func (v *evalVisitor) popBlock() *ast.BlockStatement {
	if len(v.blocks) == 0 {
		return nil
	}

	var result *ast.BlockStatement
	result, v.blocks = v.blocks[len(v.blocks)-1], v.blocks[:len(v.blocks)-1]

	return result
}
1021349
func (f *DatastoreFile) Tail(n int) error {
	return f.TailFunc(n, func(line int, _ string) bool { return n > line })
}
47901
func (s *Stack) Pop() interface{} {
	p := *s
	if len(p) == 0 {
		return nil
	}
	var x interface{}
	x, p = p[len(p)-1], p[:len(p)-1]
	return x
}
1213653
func (e *EvalError) Stack() []*Frame {
	var stack []*Frame
	for fr := e.Frame; fr != nil; fr = fr.parent {
		stack = append(stack, fr)
	}
	return stack
}
1137254
func afterHeadIM(p *parser) bool {
	switch p.tok.Type {
	case TextToken:
		s := strings.TrimLeft(p.tok.Data, whitespace)
		if len(s) < len(p.tok.Data) {
			// Add the initial whitespace to the current node.
			p.addText(p.tok.Data[:len(p.tok.Data)-len(s)])
			if s == "" {
				return true
			}
			p.tok.Data = s
		}
	case StartTagToken:
		switch p.tok.DataAtom {
		case a.Html:
			return inBodyIM(p)
		case a.Body:
			p.addElement()
			p.framesetOK = false
			p.im = inBodyIM
			return true
		case a.Frameset:
			p.addElement()
			p.im = inFramesetIM
			return true
		case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Title:
			p.oe = append(p.oe, p.head)
			defer p.oe.remove(p.head)
			return inHeadIM(p)
		case a.Head:
			// Ignore the token.
			return true
		}
	case EndTagToken:
		switch p.tok.DataAtom {
		case a.Body, a.Html, a.Br:
			// Drop down to creating an implied <body> tag.
		default:
			// Ignore the token.
			return true
		}
	case CommentToken:
		p.addChild(&Node{
			Type: CommentNode,
			Data: p.tok.Data,
		})
		return true
	case DoctypeToken:
		// Ignore the token.
		return true
	}

	p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
	p.framesetOK = true
	return false
}
705327
func (win *Window) TreePop() {
	layout := win.layout
	panel_padding := win.style().Padding
	layout.AtX -= panel_padding.X + win.ctx.Style.Tab.Indent
	layout.Width += panel_padding.X + win.ctx.Style.Tab.Indent
	if layout.Row.TreeDepth == 0 {
		panic("TreePop called without opened tree nodes")
	}
	win.curNode = win.curNode.Parent
	layout.Row.TreeDepth--
}
1326502
func GetLastFrame(frames errors.StackTrace) FrameInfo {
	if len(frames) == 0 {
		return FrameInfo{}
	}
	pc := uintptr(frames[0]) - 1
	fn := runtime.FuncForPC(pc)
	if fn == nil {
		return FrameInfo{Func: fmt.Sprintf("unknown func at %v", pc)}
	}
	filePath, lineNo := fn.FileLine(pc)
	return FrameInfo{
		CallStack: GetCallStack(frames),
		Func:      FuncName(fn),
		File:      filePath,
		LineNo:    lineNo,
	}
}
1126981
func (h *segmentHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[:n-1]
	return x
}
1185305
func (p *parser) popOptions() {
	lastIdx := len(p.optionsStack) - 1
	// get the last item on the stack and then remove it by reslicing
	p.options = p.optionsStack[lastIdx]
	p.optionsStack = p.optionsStack[:lastIdx]
}
1052951
func Pop(queue Queue) interface{} {
	var result interface{}
	queue.Pop(func(obj interface{}) error {
		result = obj
		return nil
	})
	return result
}
827210
func (h *Ints) PopAll() []int {
	for n := h.Len(); n > 1; n-- {
		if h.less == nil {
			PopToLastF(n, h.list.Less, h.list.Swap)
		} else {
			PopToLastF(n, h.less, h.list.Swap)
		}
	}
	res := h.list
	h.list = nil
	return res
}