annotate lisp/cedet/semantic/analyze/refs.el @ 105423:309bc750556d

* files-x.el (modify-dir-local-variable) (copy-dir-locals-to-file-locals-prop-line): * cedet/ede/makefile-edit.el (makefile-beginning-of-command) (makefile-end-of-command): * cedet/semantic/lex.el (semantic-lex-token): * cedet/semantic/analyze/fcn.el (semantic-analyze-dereference-metatype-1): * cedet/semantic/bovine/c.el (semantic-lex-cpp-define) (semantic-lex-cpp-undef): * cedet/semantic/wisent/wisent.el (wisent-skip-block): * cedet/srecode/srt-mode.el (semantic-beginning-of-context) (semantic-end-of-context): Fix typos in docstrings.
author Juanma Barranquero <lekktu@gmail.com>
date Sun, 04 Oct 2009 01:44:39 +0000
parents 7f4c7f5c0eba
children 83dde921cc1b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; semantic/analyze/refs.el --- Analysis of the references between tags.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; Analyze the references between tags.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; The original purpose of these analysis is to provide a way to jump
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; between a prototype and implementation.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; Finding all prototype/impl matches is hard because you have to search
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; through the entire set of allowed databases to capture all possible
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; refs. The core analysis class stores basic starting point, and then
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; entire raw search data, which is expensive to calculate.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;; Once the raw data is available, queries for impl, prototype, or
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; perhaps other things become cheap.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
37 (require 'semantic)
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
38 (require 'semantic/analyze)
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
39 (require 'semantic/db-find)
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
40 (eval-when-compile (require 'semantic/find))
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
41
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
42 (declare-function data-debug-new-buffer "data-debug")
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
43 (declare-function data-debug-insert-object-slots "eieio-datadebug")
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
44 (declare-function semantic-momentary-highlight-tag "semantic/decorate")
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
45
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 ;;; Code:
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (defclass semantic-analyze-references ()
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 ((tag :initarg :tag
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 :type semantic-tag
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 :documentation
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 "The starting TAG we are providing references analysis for.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 (tagdb :initarg :tagdb
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 :documentation
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 "The database that tag can be found in.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (scope :initarg :scope
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 :documentation "A Scope object.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 (rawsearchdata :initarg :rawsearchdata
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 :documentation
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 "The raw search data for TAG's name across all databases.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 ;; Note: Should I cache queried data here? I expect that searching
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 ;; through rawsearchdata will be super-fast, so why bother?
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 "Class containing data from a semantic analysis.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 (define-overloadable-function semantic-analyze-tag-references (tag &optional db)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 "Analyze the references for TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 Returns a class with information about TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 Optional argument DB is a database. It will be used to help
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 locate TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 Use `semantic-analyze-current-tag' to debug this fcn.")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (defun semantic-analyze-tag-references-default (tag &optional db)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 "Analyze the references for TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 Returns a class with information about TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 Optional argument DB is a database. It will be used to help
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 locate TAG.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 Use `semantic-analyze-current-tag' to debug this fcn."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (when (not (semantic-tag-p tag)) (signal 'wrong-type-argument (list 'semantic-tag-p tag)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 (let ((allhits nil)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (scope nil)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 (save-excursion
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (semantic-go-to-tag tag db)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (setq scope (semantic-calculate-scope))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (setq allhits (semantic--analyze-refs-full-lookup tag scope))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (semantic-analyze-references (semantic-tag-name tag)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 :tag tag
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 :tagdb db
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 :scope scope
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 :rawsearchdata allhits)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 )))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 ;;; METHODS
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 ;; These accessor methods will calculate the useful bits from the context, and cache values
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 ;; into the context.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (defmethod semantic-analyze-refs-impl ((refs semantic-analyze-references) &optional in-buffer)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 "Return the implementations derived in the reference analyzer REFS.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 Optional argument IN-BUFFER indicates that the returned tag should be in an active buffer."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (let ((allhits (oref refs rawsearchdata))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (impl nil)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (semanticdb-find-result-mapc
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (lambda (T DB)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 "Examine T in the database DB, and sont it."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (let* ((ans (semanticdb-normalize-one-tag DB T))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (aT (cdr ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (aDB (car ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (when (not (semantic-tag-prototype-p aT))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (when in-buffer (save-excursion (semantic-go-to-tag aT aDB)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (push aT impl))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 allhits)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 impl))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (defmethod semantic-analyze-refs-proto ((refs semantic-analyze-references) &optional in-buffer)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 "Return the prototypes derived in the reference analyzer REFS.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 Optional argument IN-BUFFER indicates that the returned tag should be in an active buffer."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (let ((allhits (oref refs rawsearchdata))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (proto nil))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (semanticdb-find-result-mapc
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (lambda (T DB)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 "Examine T in the database DB, and sort it."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (let* ((ans (semanticdb-normalize-one-tag DB T))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (aT (cdr ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (aDB (car ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (when (semantic-tag-prototype-p aT)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (when in-buffer (save-excursion (semantic-go-to-tag aT aDB)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 (push aT proto))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 allhits)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 proto))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 ;;; LOOKUP
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 ;;
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (defun semantic--analyze-refs-full-lookup (tag scope)
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104470
diff changeset
143 "Perform a full lookup for all occurrences of TAG in the current project.
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 TAG should be the tag currently under point.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 PARENT is the list of tags that are parents to TAG by
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 containment, as opposed to reference."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (if (not (oref scope parents))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 ;; If this tag has some named parent, but is not
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (semantic--analyze-refs-full-lookup-simple tag)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 ;; We have some sort of lineage we need to consider when we do
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ;; our side lookup of tags.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (semantic--analyze-refs-full-lookup-with-parents tag scope)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 ))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (defun semantic--analyze-refs-find-child-in-find-results (find-results name class)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 "Find in FIND-RESULT a tag NAME which is a child of a tag in FIND-RESULTS.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 CLASS is the class of the tag that ought to be returned."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (let ((ans nil)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (subans nil))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 ;; Loop over each segment of the find results.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (dolist (FDB find-results)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (setq subans nil)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 ;; Loop over each tag in the find results.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (dolist (T (cdr FDB))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 ;; For each tag, get the children.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (let* ((chil (semantic-tag-type-members T))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (match (semantic-find-tags-by-name name chil)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 ;; Go over the matches, looking for matching tag class.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 (dolist (M match)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 (when (semantic-tag-of-class-p M class)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 (push M subans)))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 ;; Store current matches into a new find results.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 (when subans
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (push (cons (car FDB) subans) ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (defun semantic--analyze-refs-find-tags-with-parent (find-results parents)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 "Find in FIND-RESULTS all tags with PARNTS.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 NAME is the name of the tag needing finding.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 PARENTS is a list of names."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (let ((ans nil))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (semanticdb-find-result-mapc
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 (lambda (tag db)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (let* ((p (semantic-tag-named-parent tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (ps (when (stringp p)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (semantic-analyze-split-name p))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (when (stringp ps) (setq ps (list ps)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (when (and ps (equal ps parents))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 ;; We could optimize this, but it seems unlikely.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (push (list db tag) ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 ))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 find-results)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 ans))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (defun semantic--analyze-refs-full-lookup-with-parents (tag scope)
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104470
diff changeset
198 "Perform a lookup for all occurrences of TAG based on TAG's SCOPE.
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 TAG should be the tag currently under point."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (let* ((classmatch (semantic-tag-class tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (plist (mapcar (lambda (T) (semantic-tag-name T)) (oref scope parents)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 ;; The first item in the parent list
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (name (car plist))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 ;; Stuff from the simple list.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (simple (semantic--analyze-refs-full-lookup-simple tag t))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 ;; Find all hits for the first parent name.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (brute (semanticdb-find-tags-collector
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (lambda (table tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (semanticdb-find-tags-by-name-method table name tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 nil nil t))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 ;; Prime the answer.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (answer (semantic--analyze-refs-find-tags-with-parent simple plist))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 ;; First parent is already search to initialize "brute".
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (setq plist (cdr plist))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;; Go through the list of parents, and try to find matches.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 ;; As we cycle through plist, for each level look for NAME,
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 ;; and compare the named-parent, and also dive into the next item of
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 ;; plist.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (while (and plist brute)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 ;; Find direct matches
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (let* ((direct (semantic--analyze-refs-find-child-in-find-results
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 brute (semantic-tag-name tag) classmatch))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (pdirect (semantic--analyze-refs-find-tags-with-parent
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 direct plist)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (setq answer (append pdirect answer)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 ;; The next set of search items.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (setq brute (semantic--analyze-refs-find-child-in-find-results
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 brute (car plist) 'type))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (setq plist (cdr plist)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 ;; Brute now has the children from the very last match.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (let* ((direct (semantic--analyze-refs-find-child-in-find-results
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 brute (semantic-tag-name tag) classmatch))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (setq answer (append direct answer)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 answer))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (defun semantic--analyze-refs-full-lookup-simple (tag &optional noerror)
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104470
diff changeset
245 "Perform a simple lookup for occurrences of TAG in the current project.
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 TAG should be the tag currently under point.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 Optional NOERROR means don't throw errors on failure to find something.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 This only compares the tag name, and does not infer any matches in namespaces,
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 or parts of some other data structure.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 Only works for tags in the global namespace."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (let* ((name (semantic-tag-name tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (brute (semanticdb-find-tags-collector
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (lambda (table tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (semanticdb-find-tags-by-name-method table name tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 nil nil t))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (when (and (not brute) (not noerror))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 ;; An error, because tag under point ought to be found.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (error "Cannot find any references to %s in wide search" name))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (let* ((classmatch (semantic-tag-class tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (RES
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 (semanticdb-find-tags-collector
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 (lambda (table tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 (semantic-find-tags-by-class classmatch tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 ;; @todo - Add parent check also.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 brute nil)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (when (and (not RES) (not noerror))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (error "Cannot find any definitions for %s in wide search"
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (semantic-tag-name tag)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 ;; Return the matching tags and databases.
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 RES)))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 ;;; USER COMMANDS
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 ;;
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
282 ;;;###autoload
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (defun semantic-analyze-current-tag ()
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 "Analyze the tag under point."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (interactive)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (let* ((tag (semantic-current-tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (start (current-time))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (sac (semantic-analyze-tag-references tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (end (current-time))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (message "Analysis took %.2f seconds." (semantic-elapsed-time start end))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (if sac
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (progn
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
294 (require 'eieio-datadebug)
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 (data-debug-new-buffer "*Analyzer Reference ADEBUG*")
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (data-debug-insert-object-slots sac "]"))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (message "No Context to analyze here."))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
299 ;;;###autoload
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 (defun semantic-analyze-proto-impl-toggle ()
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 "Toggle between the implementation, and a prototype of tag under point."
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (interactive)
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
303 (require 'semantic/decorate)
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 (semantic-fetch-tags)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (let* ((tag (semantic-current-tag))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (sar (if tag
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (semantic-analyze-tag-references tag)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 (error "Point must be in a declaration")))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (target (if (semantic-tag-prototype-p tag)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (car (semantic-analyze-refs-impl sar t))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (car (semantic-analyze-refs-proto sar t))))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 (when (not target)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 (error "Could not find suitable %s"
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 (if (semantic-tag-prototype-p tag) "implementation" "prototype")))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (push-mark)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (semantic-go-to-tag target)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 (switch-to-buffer (current-buffer))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (semantic-momentary-highlight-tag target))
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 )
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (provide 'semantic/analyze/refs)
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325
104456
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
326 ;; Local variables:
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
327 ;; generated-autoload-file: "../loaddefs.el"
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
328 ;; generated-autoload-feature: semantic/loaddefs
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
329 ;; generated-autoload-load-name: "semantic/analyze/refs"
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
330 ;; End:
6065d66f0c99 lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents: 104421
diff changeset
331
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105340
diff changeset
332 ;; arch-tag: f8c59a91-1829-42b3-b083-437c6881841c
104421
b66bb908c129 cedet/semantic/debug.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 ;;; semantic/analyze/refs.el ends here