Function: semantic-bucketize
semantic-bucketize is a byte-compiled function defined in sort.el.gz.
Signature
(semantic-bucketize TAGS &optional PARENT FILTER)
Documentation
Sort TAGS into a group of buckets based on tag class.
Unknown classes are placed in a Misc bucket.
Type bucket names are defined by either semantic-symbol->name-assoc-list.
If PARENT is specified, then TAGS belong to this PARENT in some way.
This will use semantic-symbol->name-assoc-list-for-type-parts to
generate bucket names.
Optional argument FILTER is a filter function to be applied to each bucket.
The filter function will take one argument, which is a list of tokens, and
may re-organize the list with side-effects.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/sort.el.gz
(defun semantic-bucketize (tags &optional parent filter)
"Sort TAGS into a group of buckets based on tag class.
Unknown classes are placed in a Misc bucket.
Type bucket names are defined by either `semantic-symbol->name-assoc-list'.
If PARENT is specified, then TAGS belong to this PARENT in some way.
This will use `semantic-symbol->name-assoc-list-for-type-parts' to
generate bucket names.
Optional argument FILTER is a filter function to be applied to each bucket.
The filter function will take one argument, which is a list of tokens, and
may re-organize the list with side-effects."
(let* ((name-list (if parent
semantic-symbol->name-assoc-list-for-type-parts
semantic-symbol->name-assoc-list))
(sn name-list)
(bins (make-vector (1+ (length sn)) nil))
ask tagtype
(nsn nil)
(num 1)
(out nil))
;; Build up the bucket vector
(while sn
(setq nsn (cons (cons (car (car sn)) num) nsn)
sn (cdr sn)
num (1+ num)))
;; Place into buckets
(while tags
(setq tagtype (funcall semantic-bucketize-tag-class (car tags))
ask (assq tagtype nsn)
num (or (cdr ask) 0))
(aset bins num (cons (car tags) (aref bins num)))
(setq tags (cdr tags)))
;; Remove from buckets into a list.
(setq num 1)
(while (< num (length bins))
(when (aref bins num)
(setq out
(cons (cons
(cdr (nth (1- num) name-list))
;; Filtering, First hacked by David Ponce david@dponce.com
(funcall (or filter 'nreverse) (aref bins num)))
out)))
(setq num (1+ num)))
(if (aref bins 0)
(setq out (cons (cons "Misc"
(funcall (or filter 'nreverse) (aref bins 0)))
out)))
(nreverse out)))