Mercurial > emacs
annotate lisp/cedet/semantic/db-ref.el @ 104417:6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
cedet/semantic/db-ref.el, cedet/semantic/find.el,
cedet/semantic/format.el, cedet/semantic/sort.el: New files.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 28 Aug 2009 19:18:35 +0000 |
parents | |
children | 902d22a2d922 |
rev | line source |
---|---|
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; db-ref.el --- Handle cross-db file references |
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) 2007, 2008, 2009 Free Software Foundation, Inc. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; 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
|
8 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; 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
|
10 ;; 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
|
11 ;; 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
|
12 ;; (at your option) any later version. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; 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
|
15 ;; 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
|
16 ;; 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
|
17 ;; 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
|
18 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; 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
|
20 ;; 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
|
21 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
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 ;; Handle cross-database file references. |
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 ;; Any given database may be referred to by some other database. For |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; example, if a .cpp file has a #include in a header, then that |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; header file should have a reference to the .cpp file that included |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; it. |
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 ;; This is critical for purposes where a file (such as a .cpp file) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; needs to have its caches flushed because of changes in the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; header. Changing a header may cause a referring file to be |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; reparsed due to account for changes in defined macros, or perhaps |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; a change to files the header includes. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;;; Code: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (defmethod semanticdb-add-reference ((dbt semanticdb-abstract-table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 include-tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 "Add a reference for the database table DBT based on INCLUDE-TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 DBT is the database table that owns the INCLUDE-TAG. The reference |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 will be added to the database that INCLUDE-TAG refers to." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; NOTE: I should add a check to make sure include-tag is in DB. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; but I'm too lazy. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (let* ((semanticdb-find-default-throttle |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (if (featurep 'semanticdb-find) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (remq 'unloaded semanticdb-find-default-throttle) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (refdbt (semanticdb-find-table-for-include include-tag dbt)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;;(fullfile (semanticdb-full-filename dbt)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (when refdbt |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;; Add our filename (full path) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 ;; (object-add-to-list refdbt 'file-refs fullfile) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;; Add our database. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (object-add-to-list refdbt 'db-refs dbt) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 t))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (defmethod semanticdb-check-references ((dbt semanticdb-abstract-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 "Check and cleanup references in the database DBT. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 Abstract tables would be difficult to reference." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ;; Not sure how an abstract table can have references. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 nil) |
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 (defmethod semanticdb-includes-in-table ((dbt semanticdb-abstract-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 "Return a list of direct includes in table DBT." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (semantic-find-tags-by-class 'include (semanticdb-get-tags dbt))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (defmethod semanticdb-check-references ((dbt semanticdb-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 "Check and cleanup references in the database DBT. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 Any reference to a file that cannot be found, or whos file no longer |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 refers to DBT will be removed." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (let ((refs (oref dbt db-refs)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (myexpr (concat "\\<" (oref dbt file))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (while refs |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (let* ((ok t) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (db (car refs)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (f (when (semanticdb-table-child-p db) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (semanticdb-full-filename db))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 ;; The file was deleted |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (when (and f (not (file-exists-p f))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (setq ok nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ;; The reference no longer includes the textual reference? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (let* ((refs (semanticdb-includes-in-table db)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (inc (semantic-find-tags-by-name-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 myexpr refs))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (when (not inc) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (setq ok 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 ;; Remove not-ok databases from the list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (when (not ok) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (object-remove-from-list dbt 'db-refs db) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (setq refs (cdr refs))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (defmethod semanticdb-refresh-references ((dbt semanticdb-abstract-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 "Refresh references to DBT in other files." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ;; alternate tables can't be edited, so can't be changed. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (defmethod semanticdb-refresh-references ((dbt semanticdb-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 "Refresh references to DBT in other files." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (let ((refs (semanticdb-includes-in-table dbt)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (while refs |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (if (semanticdb-add-reference dbt (car refs)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 ;; If we succeeded, then do... nothing? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (setq refs (cdr refs))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (defmethod semanticdb-notify-references ((dbt semanticdb-table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 method) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 "Notify all references of the table DBT using method. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 METHOD takes two arguments. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (METHOD TABLE-TO-NOTIFY DBT) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 TABLE-TO-NOTIFY is a semanticdb-table which is being notified. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 DBT, the second argument is DBT." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (mapc (lambda (R) (funcall method R dbt)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (oref dbt db-refs))) |
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 ;;; DEBUG |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (defclass semanticdb-ref-adebug () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 ((i-depend-on :initarg :i-depend-on) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (local-table :initarg :local-table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (i-include :initarg :i-include)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 "Simple class to allow ADEBUG to show a nice list.") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (defun semanticdb-ref-test (refresh) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 "Dump out the list of references for the current buffer. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 If REFRESH is non-nil, cause the current table to have it's references |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 refreshed before dumping the result." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (interactive "p") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ;; If we need to refresh... then do so. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (when refresh |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (semanticdb-refresh-references semanticdb-current-table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 ;; Do the debug system |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (let* ((tab semanticdb-current-table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (myrefs (oref tab db-refs)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (myinc (semanticdb-includes-in-table tab)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (adbc (semanticdb-ref-adebug "DEBUG" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 :i-depend-on myrefs |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 :local-table tab |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 :i-include myinc))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (data-debug-new-buffer "*References ADEBUG*") |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (data-debug-insert-object-slots adbc "!")) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (provide 'semantic/db-ref) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 ;;; semanticdb-ref.el ends here |