package trie import ( "bytes" "github.com/ethereum/go-ethereum/ethutil" ) type NodeType byte const ( EmptyNode NodeType = iota BranchNode LeafNode ExtNode ) func getType(node *ethutil.Value) NodeType { if node.Len() == 0 { return EmptyNode } if node.Len() == 2 { k := CompactDecode(node.Get(0).Str()) if HasTerm(k) { return LeafNode } return ExtNode } return BranchNode } type Iterator struct { Path [][]byte trie *Trie Key []byte Value *ethutil.Value } func NewIterator(trie *Trie) *Iterator { return &Iterator{trie: trie} } func (self *Iterator) key(node *ethutil.Value, path [][]byte) []byte { switch getType(node) { case LeafNode: k := RemTerm(CompactDecode(node.Get(0).Str())) self.Path = append(path, k) self.Value = node.Get(1) return k case BranchNode: if node.Get(16).Len() > 0 { return []byte{16} } for i := byte(0); i < 16; i++ { o := self.key(self.trie.getNode(node.Get(int(i)).Raw()), append(path, []byte{i})) if o != nil { return append([]byte{i}, o...) } } case ExtNode: currKey := node.Get(0).Bytes() return self.key(self.trie.getNode(node.Get(1).Raw()), append(path, currKey)) } return nil } func (self *Iterator) next(node *ethutil.Value, key []byte, path [][]byte) []byte { switch typ := getType(node); typ { case EmptyNode: return nil case BranchNode: if len(key) > 0 { subNode := self.trie.getNode(node.Get(int(key[0])).Raw()) o := self.next(subNode, key[1:], append(path, key[:1])) if o != nil { return append([]byte{key[0]}, o...) } } var r byte = 0 if len(key) > 0 { r = key[0] + 1 } for i := r; i < 16; i++ { subNode := self.trie.getNode(node.Get(int(i)).Raw()) o := self.key(subNode, append(path, []byte{i})) if o != nil { return append([]byte{i}, o...) } } case LeafNode, ExtNode: k := RemTerm(CompactDecode(node.Get(0).Str())) if typ == LeafNode { if bytes.Compare([]byte(k), []byte(key)) > 0 { self.Value = node.Get(1) self.Path = append(path, k) return k } } else { subNode := self.trie.getNode(node.Get(1).Raw()) subKey := key[len(k):] var ret []byte if BeginsWith(key, k) { ret = self.next(subNode, subKey, append(path, k)) } else if bytes.Compare(k, key[:len(k)]) > 0 { ret = self.key(node, append(path, k)) } else { ret = nil } if ret != nil { return append(k, ret...) } } } return nil } // Get the next in keys func (self *Iterator) Next(key string) []byte { self.trie.mut.Lock() defer self.trie.mut.Unlock() k := RemTerm(CompactHexDecode(key)) n := self.next(self.trie.getNode(self.trie.Root), k, nil) self.Key = []byte(DecodeCompact(n)) return self.Key } f26a4bd0913ff52557dae834ef9a378e07a8fad2 - Fix timidity directory - Add pkg-message with information on timidity configuration
- Fix timidity directory
- Add pkg-message with information on timidity configuration
Add OPTIONS_DEFINE=DOCS for ports with %%PORTDOCS%% in the plist. 2014-07-15T23:11:12+00:00 adamw adamw@FreeBSD.org 2014-07-15T23:11:12+00:00 9343eeba7783ac2ce4c8f5c88ab322647d489c19 Where possible, correct a few instances where PORTDOCS was being used to flag stuff in EXAMPLESDIR. For some ports, mostly those owned by ruby@, PORTDOCS is applied to pretty much everything whether it's documentation or example.
Where possible, correct a few instances where PORTDOCS was being used
to flag stuff in EXAMPLESDIR. For some ports, mostly those owned by
ruby@, PORTDOCS is applied to pretty much everything whether it's
documentation or example.
Multiple ports: reset maintainers 2014-05-26T02:33:38+00:00 eadler eadler@FreeBSD.org 2014-05-26T02:33:38+00:00 6dbe7776afee78f1569a5b061bc3cef9f23442cd Maintainers for these ports have been notified on 5 separate occasions over the course of several months about pending actions required. We really appreciate the time and effort you put in to maintain these ports. If you are still interested in helping to maintain these ports just reply to me or file a PR and I will happily assign the port to you again. Approved by: portmgr (implicit)
	Maintainers for these ports have been notified on 5 separate occasions
	over the course of several months about pending actions required.

	We really appreciate the time and effort you put in to maintain
	these ports.

	If you are still interested in helping to maintain these ports just
	reply to me or file a PR and I will happily assign the port to you
	again.

Approved by:	portmgr (implicit)
- Stage support 2014-02-09T10:32:15+00:00 miwi miwi@FreeBSD.org 2014-02-09T10:32:15+00:00 38e35cb77de2020a281fdbbcc3e8ee3b7bad4967

Convert to PORT_OPTIONS:MDOCS. 2014-01-03T15:26:06+00:00 adamw adamw@FreeBSD.org 2014-01-03T15:26:06+00:00 855b8f9eb8b6c8d2ac7ab50561b4fcac8c30ac99 Holdout shame list: ruby, perl, python
Holdout shame list: ruby, perl, python
Add NO_STAGE all over the place in preparation for the staging support (cat: audio) 2013-09-20T14:36:35+00:00 bapt bapt@FreeBSD.org 2013-09-20T14:36:35+00:00 364fbf2c9f577bf02f623faf4a3cbad00fc1c84f

Remove USE_REINPLACE from ports in categories starting with A. 2006-05-03T05:14:35+00:00 edwin edwin@FreeBSD.org 2006-05-03T05:14:35+00:00 1915f515b216a732336342dc5f75fc15522dd386