Mercurial > emacs
annotate lisp/cedet/semantic/sort.el @ 104449:217c6a8e8420
lisp/cedet/semantic.el (semantic--set-buffer-cache): Ensure that
semantic-bovinate-nonterminal-check-obarray is buffer-local.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 20:32:50 +0000 |
parents | 273e528a9f9b |
children | 1da44e87bf90 |
rev | line source |
---|---|
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; sort.el --- Utilities for sorting and re-arranging tag tables. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; 2008, 2009 Free Software Foundation, Inc. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: syntax |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Tag tables originate in the order they appear in a buffer, or source file. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; It is often useful to re-arrange them is some predictable way for browsing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; purposes. Re-organization may be alphabetical, or even a complete |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; reorganization of parents and children. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; Originally written in semantic-util.el |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'assoc) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (require 'semantic) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (require 'semantic/db) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (eval-when-compile |
104446
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
38 (require 'semantic/find)) |
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
39 |
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
40 (declare-function semanticdb-find-tags-external-children-of-type |
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
41 "semantic/db-find") |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;;; Alphanumeric sorting |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; Takes a list of tags, and sorts them in a case-insensitive way |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; at a single level. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 ;;; Code: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (defun semantic-string-lessp-ci (s1 s2) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 "Case insensitive version of `string-lessp'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 Argument S1 and S2 are the strings to compare." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;; Use downcase instead of upcase because an average name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; has more lower case characters. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (if (fboundp 'compare-strings) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (eq (compare-strings s1 0 nil s2 0 nil t) -1) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (string-lessp (downcase s1) (downcase s2)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (defun semantic-sort-tag-type (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 "Return a type string for TAG guaranteed to be a string." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (let ((ty (semantic-tag-type tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (cond ((stringp ty) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 ty) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 ((listp ty) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (or (car ty) "")) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (t "")))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (defun semantic-tag-lessp-name-then-type (A B) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 "Return t if tag A is < tag B. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 First sorts on name, then sorts on the name of the :type of |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 each tag." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (let ((na (semantic-tag-name A)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (nb (semantic-tag-name B)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (if (string-lessp na nb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 t ; a sure thing. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (if (string= na nb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 ;; If equal, test the :type which might be different. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (let* ((ta (semantic-tag-type A)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (tb (semantic-tag-type B)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (tas (cond ((stringp ta) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 ta) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 ((semantic-tag-p ta) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (semantic-tag-name ta)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (t nil))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (tbs (cond ((stringp tb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 tb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 ((semantic-tag-p tb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (semantic-tag-name tb)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (t nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (if (and (stringp tas) (stringp tbs)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (string< tas tbs) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;; This is if A == B, and no types in A or B |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ;; This nil is if A > B, but not = |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (defun semantic-sort-tags-by-name-increasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 "Sort TAGS by name in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (string-lessp (semantic-tag-name a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (semantic-tag-name b))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (defun semantic-sort-tags-by-name-decreasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 "Sort TAGS by name in decreasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (string-lessp (semantic-tag-name b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (semantic-tag-name a))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (defun semantic-sort-tags-by-type-increasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 "Sort TAGS by type in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (string-lessp (semantic-sort-tag-type a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (semantic-sort-tag-type b))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (defun semantic-sort-tags-by-type-decreasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 "Sort TAGS by type in decreasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (string-lessp (semantic-sort-tag-type b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (semantic-sort-tag-type a))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (defun semantic-sort-tags-by-name-increasing-ci (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 "Sort TAGS by name in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (semantic-string-lessp-ci (semantic-tag-name a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (semantic-tag-name b))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (defun semantic-sort-tags-by-name-decreasing-ci (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 "Sort TAGS by name in decreasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (semantic-string-lessp-ci (semantic-tag-name b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (semantic-tag-name a))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (defun semantic-sort-tags-by-type-increasing-ci (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 "Sort TAGS by type in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (semantic-string-lessp-ci (semantic-sort-tag-type a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (semantic-sort-tag-type b))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (defun semantic-sort-tags-by-type-decreasing-ci (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 "Sort TAGS by type in decreasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (sort tags (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (semantic-string-lessp-ci (semantic-sort-tag-type b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (semantic-sort-tag-type a))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (defun semantic-sort-tags-by-name-then-type-increasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 "Sort TAGS by name, then type in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (sort tags (lambda (a b) (semantic-tag-lessp-name-then-type a b)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (defun semantic-sort-tags-by-name-then-type-decreasing (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 "Sort TAGS by name, then type in increasing order with side effects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 Return the sorted list." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (sort tags (lambda (a b) (semantic-tag-lessp-name-then-type b a)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (semantic-alias-obsolete 'semantic-sort-tokens-by-name-increasing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 'semantic-sort-tags-by-name-increasing) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (semantic-alias-obsolete 'semantic-sort-tokens-by-name-decreasing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 'semantic-sort-tags-by-name-decreasing) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (semantic-alias-obsolete 'semantic-sort-tokens-by-type-increasing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 'semantic-sort-tags-by-type-increasing) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (semantic-alias-obsolete 'semantic-sort-tokens-by-type-decreasing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 'semantic-sort-tags-by-type-decreasing) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (semantic-alias-obsolete 'semantic-sort-tokens-by-name-increasing-ci |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 'semantic-sort-tags-by-name-increasing-ci) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (semantic-alias-obsolete 'semantic-sort-tokens-by-name-decreasing-ci |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 'semantic-sort-tags-by-name-decreasing-ci) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (semantic-alias-obsolete 'semantic-sort-tokens-by-type-increasing-ci |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 'semantic-sort-tags-by-type-increasing-ci) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (semantic-alias-obsolete 'semantic-sort-tokens-by-type-decreasing-ci |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 'semantic-sort-tags-by-type-decreasing-ci) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 ;;; Unique |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 ;; Scan a list of tags, removing duplicates. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 ;; This must first sort the tags by name alphabetically ascending. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 ;; Useful for completion lists, or other situations where the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 ;; other data isn't as useful. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (defun semantic-unique-tag-table-by-name (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 "Scan a list of TAGS, removing duplicate names. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 This must first sort the tags by name alphabetically ascending. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 For more complex uniqueness testing used by the semanticdb |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 typecaching system, see `semanticdb-typecache-merge-streams'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (let ((sorted (semantic-sort-tags-by-name-increasing |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (copy-sequence tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (uniq nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 (while sorted |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (if (or (not uniq) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (not (string= (semantic-tag-name (car sorted)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (semantic-tag-name (car uniq))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (setq uniq (cons (car sorted) uniq))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (setq sorted (cdr sorted)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (nreverse uniq))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (defun semantic-unique-tag-table (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 "Scan a list of TAGS, removing duplicates. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 This must first sort the tags by position ascending. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 TAGS are removed only if they are equivalent, as can happen when |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 multiple tag sources are scanned. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 For more complex uniqueness testing used by the semanticdb |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 typecaching system, see `semanticdb-typecache-merge-streams'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (let ((sorted (sort (copy-sequence tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (lambda (a b) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (cond ((not (semantic-tag-with-position-p a)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 t) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 ((not (semantic-tag-with-position-p b)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (t |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (< (semantic-tag-start a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (semantic-tag-start b))))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (uniq nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (while sorted |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (if (or (not uniq) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (not (semantic-equivalent-tag-p (car sorted) (car uniq)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (setq uniq (cons (car sorted) uniq))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (setq sorted (cdr sorted)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (nreverse uniq))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 ;;; Tag Table Flattening |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 ;; In the 1.4 search API, there was a parameter "search-parts" which |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ;; was used to find tags inside other tags. This was used |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; infrequently, mostly for completion/jump routines. These types |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ;; of commands would be better off with a flattened list, where all |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 ;; tags appear at the top level. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
241 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (defun semantic-flatten-tags-table (&optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 "Flatten the tags table TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 All tags in TABLE, and all components of top level tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 in TABLE will appear at the top level of list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 Tags promoted to the top of the list will still appear |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 unmodified as components of their parent tags." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (let* ((table (semantic-something-to-tag-table table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 ;; Initialize the starting list with our table. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (lists (list table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (mapc (lambda (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (let ((components (semantic-tag-components tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (if (and components |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;; unpositined tags can be hazardous to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 ;; completion. Do we need any type of tag |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 ;; here? - EL |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (semantic-tag-with-position-p (car components))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (setq lists (cons |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (semantic-flatten-tags-table components) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 lists))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (apply 'append (nreverse lists)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 ;;; Buckets: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 ;; A list of tags can be grouped into buckets based on the tag class. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ;; Bucketize means to take a list of tags at a given level in a tag |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 ;; table, and reorganize them into buckets based on class. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (defvar semantic-bucketize-tag-class |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 ;; Must use lambda because `semantic-tag-class' is a macro. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (lambda (tok) (semantic-tag-class tok)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 "Function used to get a symbol describing the class of a tag. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 This function must take one argument of a semantic tag. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 It should return a symbol found in `semantic-symbol->name-assoc-list' |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 which `semantic-bucketize' uses to bin up tokens. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 To create new bins for an application augment |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 `semantic-symbol->name-assoc-list', and |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 `semantic-symbol->name-assoc-list-for-type-parts' in addition |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 to setting this variable (locally in your function).") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 (defun semantic-bucketize (tags &optional parent filter) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 "Sort TAGS into a group of buckets based on tag class. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 Unknown classes are placed in a Misc bucket. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 Type bucket names are defined by either `semantic-symbol->name-assoc-list'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 If PARENT is specified, then TAGS belong to this PARENT in some way. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 This will use `semantic-symbol->name-assoc-list-for-type-parts' to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 generate bucket names. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 Optional argument FILTER is a filter function to be applied to each bucket. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 The filter function will take one argument, which is a list of tokens, and |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 may re-organize the list with side-effects." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (let* ((name-list (if parent |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 semantic-symbol->name-assoc-list-for-type-parts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 semantic-symbol->name-assoc-list)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (sn name-list) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (bins (make-vector (1+ (length sn)) nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 ask tagtype |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (nsn nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (num 1) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (out nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 ;; Build up the bucket vector |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (while sn |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (setq nsn (cons (cons (car (car sn)) num) nsn) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 sn (cdr sn) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 num (1+ num))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 ;; Place into buckets |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (setq tagtype (funcall semantic-bucketize-tag-class (car tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ask (assq tagtype nsn) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 num (or (cdr ask) 0)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (aset bins num (cons (car tags) (aref bins num))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 ;; Remove from buckets into a list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (setq num 1) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (while (< num (length bins)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (when (aref bins num) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (setq out |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (cons (cons |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (cdr (nth (1- num) name-list)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 ;; Filtering, First hacked by David Ponce david@dponce.com |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (funcall (or filter 'nreverse) (aref bins num))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 out))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (setq num (1+ num))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (if (aref bins 0) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (setq out (cons (cons "Misc" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (funcall (or filter 'nreverse) (aref bins 0))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 out))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (nreverse out))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 ;;; Adoption |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 ;; Some languages allow children of a type to be defined outside |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 ;; the syntactic scope of that class. These routines will find those |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 ;; external members, and bring them together in a cloned copy of the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 ;; class tag. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (defvar semantic-orphaned-member-metaparent-type "class" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 "In `semantic-adopt-external-members', the type of 'type for metaparents. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 A metaparent is a made-up type semantic token used to hold the child list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 of orphaned members of a named type.") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 (make-variable-buffer-local 'semantic-orphaned-member-metaparent-type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (defvar semantic-mark-external-member-function nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 "Function called when an externally defined orphan is found. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 By default, the token is always marked with the `adopted' property. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 This function should be locally bound by a program that needs |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 to add additional behaviors into the token list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 This function is called with two arguments. The first is TOKEN which is |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 a shallow copy of the token to be modified. The second is the PARENT |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 which is adopting TOKEN. This function should return TOKEN (or a copy of it) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 which is then integrated into the revised token list.") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (defun semantic-adopt-external-members (tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 "Rebuild TAGS so that externally defined members are regrouped. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 Some languages such as C++ and CLOS permit the declaration of member |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 functions outside the definition of the class. It is easier to study |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 the structure of a program when such methods are grouped together |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 more logically. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 This function uses `semantic-tag-external-member-p' to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 determine when a potential child is an externally defined member. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 Note: Applications which use this function must account for token |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 types which do not have a position, but have children which *do* |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 have positions. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 Applications should use `semantic-mark-external-member-function' |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 to modify all tags which are found as externally defined to some |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 type. For example, changing the token type for generating extra |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 buckets with the bucket function." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (let ((parent-buckets nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (decent-list nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (out nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (tmp nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 ;; Rebuild the output list, stripping out all parented |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 ;; external entries |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (cond |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 ((setq tmp (semantic-tag-external-member-parent (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (let ((tagcopy (semantic-tag-clone (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (a (assoc tmp parent-buckets))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (semantic--tag-put-property-no-side-effect tagcopy 'adopted t) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (if a |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 ;; If this parent is already in the list, append. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (setcdr (nthcdr (1- (length a)) a) (list tagcopy)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 ;; If not, prepend this new parent bucket into our list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (setq parent-buckets |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (cons (cons tmp (list tagcopy)) parent-buckets))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 ((eq (semantic-tag-class (car tags)) 'type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 ;; Types need to be rebuilt from scratch so we can add in new |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 ;; children to the child list. Only the top-level cons |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 ;; cells need to be duplicated so we can hack out the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 ;; child list later. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (setq out (cons (semantic-tag-clone (car tags)) out)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 (setq decent-list (cons (car out) decent-list)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (t |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 ;; Otherwise, append this tag to our new output list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 (setq out (cons (car tags) out))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 ;; Rescan out, by descending into all types and finding parents |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 ;; for all entries moved into the parent-buckets. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (while decent-list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 (let* ((bucket (assoc (semantic-tag-name (car decent-list)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 parent-buckets)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 (bucketkids (cdr bucket))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (when bucket |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 ;; Run our secondary marking function on the children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 (if semantic-mark-external-member-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (setq bucketkids |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 (mapcar (lambda (tok) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (funcall semantic-mark-external-member-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 tok (car decent-list))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 bucketkids))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 ;; We have some extra kids. Merge. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (semantic-tag-put-attribute |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (car decent-list) :members |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (append (semantic-tag-type-members (car decent-list)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 bucketkids)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 ;; Nuke the bucket label so it is not found again. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (setcar bucket nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 (setq decent-list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (append (cdr decent-list) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 ;; get embedded types to scan and make copies |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 ;; of them. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (mapcar |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (lambda (tok) (semantic-tag-clone tok)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (semantic-find-tags-by-class 'type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (semantic-tag-type-members (car decent-list))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 ))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;; Scan over all remaining lost external methods, and tack them |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 ;; onto the end. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (while parent-buckets |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (if (car (car parent-buckets)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (let* ((tmp (car parent-buckets)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 (fauxtag (semantic-tag-new-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 (car tmp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 semantic-orphaned-member-metaparent-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 nil ;; Part list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 nil ;; parents (unknown) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 (bucketkids (cdr tmp))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 (semantic-tag-set-faux fauxtag) ;; properties |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (if semantic-mark-external-member-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (setq bucketkids |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (mapcar (lambda (tok) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (funcall semantic-mark-external-member-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 tok fauxtag)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 bucketkids))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (semantic-tag-put-attribute fauxtag :members bucketkids) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 ;; We have a bunch of methods with no parent in this file. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 ;; Create a meta-type to hold it. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (setq out (cons fauxtag out)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (setq parent-buckets (cdr parent-buckets))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 ;; Return the new list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (nreverse out))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 ;;; External children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 ;; In order to adopt external children, we need a few overload methods |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 ;; to enable the feature. |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
469 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
470 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (define-overloadable-function semantic-tag-external-member-parent (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 "Return a parent for TAG when TAG is an external member. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 TAG is an external member if it is defined at a toplevel and |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 has some sort of label defining a parent. The parent return will |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 be a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 The default behavior, if not overridden with |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 `tag-member-parent' gets the 'parent extra |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 specifier of TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 If this function is overridden, use |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 `semantic-tag-external-member-parent-default' to also |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 include the default behavior, and merely extend your own." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (defun semantic-tag-external-member-parent-default (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 "Return the name of TAGs parent only if TAG is not defined in it's parent." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 ;; Use only the extra spec because a type has a parent which |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 ;; means something completely different. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (let ((tp (semantic-tag-get-attribute tag :parent))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 (when (stringp tp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 tp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (semantic-alias-obsolete 'semantic-nonterminal-external-member-parent |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 'semantic-tag-external-member-parent) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (define-overloadable-function semantic-tag-external-member-p (parent tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 "Return non-nil if PARENT is the parent of TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 TAG is an external member of PARENT when it is somehow tagged |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 as having PARENT as it's parent. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 PARENT and TAG must both be semantic tags. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 The default behavior, if not overridden with |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 `tag-external-member-p' is to match :parent attribute in |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 the name of TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 If this function is overridden, use |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 `semantic-tag-external-member-children-p-default' to also |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 include the default behavior, and merely extend your own." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (defun semantic-tag-external-member-p-default (parent tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 "Return non-nil if PARENT is the parent of TAG." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 ;; Use only the extra spec because a type has a parent which |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 ;; means something completely different. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (let ((tp (semantic-tag-external-member-parent tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 (and (stringp tp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (string= (semantic-tag-name parent) tp)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (semantic-alias-obsolete 'semantic-nonterminal-external-member-p |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 'semantic-tag-external-member-p) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (define-overloadable-function semantic-tag-external-member-children (tag &optional usedb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 "Return the list of children which are not *in* TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 If optional argument USEDB is non-nil, then also search files in |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 the Semantic Database. If USEDB is a list of databases, search those |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 databases. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 Children in this case are functions or types which are members of |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 TAG, such as the parts of a type, but which are not defined inside |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 the class. C++ and CLOS both permit methods of a class to be defined |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 outside the bounds of the class' definition. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 The default behavior, if not overridden with |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 `tag-external-member-children' is to search using |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 `semantic-tag-external-member-p' in all top level definitions |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 with a parent of TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 If this function is overridden, use |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 `semantic-tag-external-member-children-default' to also |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 include the default behavior, and merely extend your own." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (defun semantic-tag-external-member-children-default (tag &optional usedb) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 "Return list of external children for TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 Optional argument USEDB specifies if the semantic database is used. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 See `semantic-tag-external-member-children' for details." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (if (and usedb |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (fboundp 'semanticdb-minor-mode-p) |
104446
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
552 (semanticdb-minor-mode-p) |
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
553 (require 'semantic/db-find)) |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (let ((m (semanticdb-find-tags-external-children-of-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 (semantic-tag-name tag)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (if m (apply #'append (mapcar #'cdr m)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (semantic--find-tags-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 `(lambda (tok) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 ;; This bit of annoying backquote forces the contents of |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 ;; tag into the generated lambda. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 (semantic-tag-external-member-p ',tag tok)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 (current-buffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 (define-overloadable-function semantic-tag-external-class (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 "Return a list of real tags that faux TAG might represent. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 In some languages, a method can be defined on an object which is |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 not in the same file. In this case, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 `semantic-adopt-external-members' will create a faux-tag. If it |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 is necessary to get the tag from which for faux TAG was most |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 likely derived, then this function is needed." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (unless (semantic-tag-faux-p tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 (signal 'wrong-type-argument (list tag 'semantic-tag-faux-p))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (:override) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 (defun semantic-tag-external-class-default (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 "Return a list of real tags that faux TAG might represent. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 See `semantic-tag-external-class' for details." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 (if (and (fboundp 'semanticdb-minor-mode-p) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 (semanticdb-minor-mode-p)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 (let* ((semanticdb-search-system-databases nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 (m (semanticdb-find-tags-by-class |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (semantic-tag-class tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 (semanticdb-find-tags-by-name (semantic-tag-name tag))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (semanticdb-strip-find-results m 'name)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 ;; Presumably, if the tag is faux, it is not local. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (semantic-alias-obsolete 'semantic-nonterminal-external-member-children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 'semantic-tag-external-member-children) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (provide 'semantic/sort) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
597 ;; Local variables: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
598 ;; generated-autoload-file: "loaddefs.el" |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
599 ;; generated-autoload-feature: semantic/loaddefs |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104446
diff
changeset
|
600 ;; generated-autoload-load-name: "semantic/sort" |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
601 ;; End: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
602 |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 ;;; semantic-sort.el ends here |