Mercurial > emacs
annotate lisp/cedet/semantic/db-typecache.el @ 110827:9814473572d4
Fix errors in CEDET 1.0 merge.
* semantic/tag.el (semantic-tag-version): Bump to 2.0.
* semantic/db-typecache.el (semanticdb-typecache-find-default):
* semantic/imenu.el (semantic-create-imenu-index):
* semantic/grammar.el (semantic--grammar-macro-function-tag):
* semantic/fw.el (semanticdb-without-unloaded-file-searches): Fix
require. Suggested by David Engster.
* semantic/bovine/c-by.el: Regenerate.
* semantic/lex-spp.el (semantic-lex-spp-debug-symbol): New var.
(semantic-lex-spp-enable-debug-symbol): New command
(semantic-lex-spp-value-valid-p)
(semantic-lex-spp-validate-value): New functions
(semantic-lex-spp-symbol-set)
(semantic-lex-spp-symbol-push): Add call to validate value.
(semantic-lex-spp-table-write-slot-value): Instead of erroring on
invalid values during save, just save a nil.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 29 Sep 2010 12:09:21 -0400 |
parents | a5ad4f188e19 |
children | 376148b31b5e |
rev | line source |
---|---|
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; db-typecache.el --- Manage Datatypes |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; (at your option) any later version. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Manage a datatype cache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; For typed languages like C++ collect all known types from various |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; headers, merge namespaces, and expunge duplicates. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; It is likely this feature will only be needed for C/C++. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
31 (require 'semantic) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 (require 'semantic/db) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (require 'semantic/db-find) |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
34 (require 'semantic/analyze/fcn) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
35 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
36 ;; For semantic-find-tags-by-* macros |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
37 (eval-when-compile (require 'semantic/find)) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
38 |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
39 (declare-function data-debug-insert-thing "data-debug") |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
40 (declare-function data-debug-new-buffer "data-debug") |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
41 (declare-function semantic-sort-tags-by-name-then-type-increasing "semantic/sort") |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
42 (declare-function semantic-scope-tag-clone-with-scope "semantic/scope") |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;;; Code: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;;; TABLE TYPECACHE |
104483
785c1bb5253e
lisp/cedet/semantic/db-typecache.el (semanticdb-typecache)
Chong Yidong <cyd@stupidchicken.com>
parents:
104470
diff
changeset
|
48 ;;;###autoload |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (defclass semanticdb-typecache () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ((filestream :initform nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 :documentation |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 "Fully sorted/merged list of tags within this buffer.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (includestream :initform nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 :documentation |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 "Fully sorted/merged list of tags from this file's includes list.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (stream :initform nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 :documentation |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 "The searchable tag stream for this cache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 NOTE: Can I get rid of this? Use a hashtable instead?") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (dependants :initform nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 :documentation |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 "Any other object that is dependent on typecache results. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 Said object must support `semantic-reset' methods.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ;; @todo - add some sort of fast-hash. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ;; @note - Rebuilds in large projects already take a while, and the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 ;; actual searches are pretty fast. Really needed? |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 "Structure for maintaining a typecache.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (defmethod semantic-reset ((tc semanticdb-typecache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 "Reset the object IDX." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (oset tc filestream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (oset tc includestream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (oset tc stream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (mapc 'semantic-reset (oref tc dependants)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (oset tc dependants nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (defmethod semanticdb-typecache-notify-reset ((tc semanticdb-typecache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 "Do a reset from a notify from a table we depend on." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (oset tc includestream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (mapc 'semantic-reset (oref tc dependants)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (oset tc dependants nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (defmethod semanticdb-partial-synchronize ((tc semanticdb-typecache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 new-tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 "Reset the typecache based on a partial reparse." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (when (semantic-find-tags-by-class 'include new-tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (oset tc includestream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (mapc 'semantic-reset (oref tc dependants)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (oset tc dependants nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (when (semantic-find-tags-by-class 'type new-tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 ;; Reset our index |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (oset tc filestream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 t ;; Return true, our core file tags have changed in a relavant way. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 ;; NO CODE HERE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (defun semanticdb-typecache-add-dependant (dep) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 "Add into the local typecache a dependant DEP." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (let* ((table semanticdb-current-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ;;(idx (semanticdb-get-table-index table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (cache (semanticdb-get-typecache table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (object-add-to-list cache 'dependants dep))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
105842
diff
changeset
|
114 (defun semanticdb-typecache-length (thing) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 "How long is THING? |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 Debugging function." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (cond ((semanticdb-typecache-child-p thing) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (length (oref thing stream))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 ((semantic-tag-p thing) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (length (semantic-tag-type-members thing))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 ((and (listp thing) (semantic-tag-p (car thing))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (length thing)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 ((null thing) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 0) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (t -1) )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (defmethod semanticdb-get-typecache ((table semanticdb-abstract-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 "Retrieve the typecache from the semanticdb TABLE. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 If there is no table, create one, and fill it in." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (semanticdb-refresh-table table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (let* ((idx (semanticdb-get-table-index table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (cache (oref idx type-cache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 ;; Make sure we have a cache object in the DB index. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (when (not cache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 ;; The object won't change as we fill it with stuff. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (setq cache (semanticdb-typecache (semanticdb-full-filename table))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (oset idx type-cache cache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 cache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (defmethod semanticdb-have-typecache-p ((table semanticdb-abstract-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 "Return non-nil (the typecache) if TABLE has a pre-calculated typecache." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (let* ((idx (semanticdb-get-table-index table))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (oref idx type-cache))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 ;;; DATABASE TYPECACHE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 ;; A full database can cache the types across its files. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 ;; Unlike file based caches, this one is a bit simpler, and just needs |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ;; to get reset when a table gets updated. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 |
104483
785c1bb5253e
lisp/cedet/semantic/db-typecache.el (semanticdb-typecache)
Chong Yidong <cyd@stupidchicken.com>
parents:
104470
diff
changeset
|
157 ;;;###autoload |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (defclass semanticdb-database-typecache (semanticdb-abstract-db-cache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 ((stream :initform nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 :documentation |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 "The searchable tag stream for this cache.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 "Structure for maintaining a typecache.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (defmethod semantic-reset ((tc semanticdb-database-typecache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 "Reset the object IDX." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (oset tc stream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (defmethod semanticdb-synchronize ((cache semanticdb-database-typecache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 new-tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 "Synchronize a CACHE with some NEW-TAGS." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (defmethod semanticdb-partial-synchronize ((cache semanticdb-database-typecache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 new-tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 "Synchronize a CACHE with some changed NEW-TAGS." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (defmethod semanticdb-get-typecache ((db semanticdb-project-database)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 "Retrieve the typecache from the semantic database DB. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 If there is no table, create one, and fill it in." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (semanticdb-cache-get db semanticdb-database-typecache) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 ;;; MERGING |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 ;; Managing long streams of tags representing data types. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (defun semanticdb-typecache-apply-filename (file stream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 "Apply the filename FILE to all tags in STREAM." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (let ((new nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (while stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (setq new (cons (semantic-tag-copy (car stream) nil file) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 new)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 ;The below is handled by the tag-copy fcn. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 ;(semantic--tag-put-property (car new) :filename file) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (setq stream (cdr stream))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (nreverse new))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (defsubst semanticdb-typecache-safe-tag-members (tag) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 "Return a list of members for TAG that are safe to permute." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (let ((mem (semantic-tag-type-members tag)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (fname (semantic-tag-file-name tag))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (if fname |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (setq mem (semanticdb-typecache-apply-filename fname mem)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (copy-sequence mem)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (defsubst semanticdb-typecache-safe-tag-list (tags table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 "Make the tag list TAGS found in TABLE safe for the typecache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 Adds a filename and copies the tags." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (semanticdb-typecache-apply-filename |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (semanticdb-full-filename table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 tags)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
220 (defun semanticdb-typecache-faux-namespace (name members) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
221 "Create a new namespace tag with NAME and a set of MEMBERS. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
222 The new tag will be a faux tag, used as a placeholder in a typecache." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
223 (let ((tag (semantic-tag-new-type name "namespace" members nil))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
224 ;; Make sure we mark this as a fake tag. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
225 (semantic-tag-set-faux tag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
226 tag)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
227 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (defun semanticdb-typecache-merge-streams (cache1 cache2) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 "Merge into CACHE1 and CACHE2 together. The Caches will be merged in place." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (if (or (and (not cache1) (not cache2)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (and (not (cdr cache1)) (not cache2)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (and (not cache1) (not (cdr cache2)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 ;; If all caches are empty OR |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 ;; cache1 is length 1 and no cache2 OR |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 ;; no cache1 and length 1 cache2 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; then just return the cache, and skip all this merging stuff. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (or cache1 cache2) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 ;; Assume we always have datatypes, as this typecache isn't really |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 ;; useful without a typed language. |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
242 (require 'semantic/sort) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (let ((S (semantic-sort-tags-by-name-then-type-increasing |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 ;; I used to use append, but it copied cache1 but not cache2. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 ;; Since sort was permuting cache2, I already had to make sure |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 ;; the caches were permute-safe. Might as well use nconc here. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (nconc cache1 cache2))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (ans nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (next nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (prev nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (type nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 ;; With all the tags in order, we can loop over them, and when |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 ;; two have the same name, we can either throw one away, or construct |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;; a fresh new tag merging the items together. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (while S |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (setq prev (car ans)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (setq next (car S)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (if (or |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 ;; CASE 1 - First item |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (null prev) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 ;; CASE 2 - New name |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (not (string= (semantic-tag-name next) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (semantic-tag-name prev)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (setq ans (cons next ans)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 ;; ELSE - We have a NAME match. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (setq type (semantic-tag-type next)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
267 (if (or (semantic-tag-of-type-p prev type) ; Are they the same datatype |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
268 (semantic-tag-faux-p prev) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
269 (semantic-tag-faux-p next) ; or either a faux tag? |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
270 ) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 ;; Same Class, we can do a merge. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (cond |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 ((and (semantic-tag-of-class-p next 'type) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (string= type "namespace")) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 ;; Namespaces - merge the children together. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (setcar ans |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
277 (semanticdb-typecache-faux-namespace |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (semantic-tag-name prev) ; - they are the same |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (semanticdb-typecache-merge-streams |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 (semanticdb-typecache-safe-tag-members prev) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (semanticdb-typecache-safe-tag-members next)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 ((semantic-tag-prototype-p next) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 ;; NEXT is a prototype... so keep previous. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 nil ; - keep prev, do nothing |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 ((semantic-tag-prototype-p prev) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 ;; PREV is a prototype, but not next.. so keep NEXT. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 ;; setcar - set by side-effect on top of prev |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (setcar ans next) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (t |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ;;(message "Don't know how to merge %s. Keeping first entry." (semantic-tag-name next)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 ;; Not same class... but same name |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 ;(message "Same name, different type: %s, %s!=%s" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 ; (semantic-tag-name next) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 ; (semantic-tag-type next) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 ; (semantic-tag-type prev)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (setq ans (cons next ans)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (setq S (cdr S))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (nreverse ans)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 ;;; Refresh / Query API |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 ;; Queries that can be made for the typecache. |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
309 (define-overloadable-function semanticdb-expand-nested-tag (tag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
310 "Expand TAG from fully qualified names. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
311 If TAG has fully qualified names, expand it to a series of nested |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
312 namespaces instead." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
313 tag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
314 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (defmethod semanticdb-typecache-file-tags ((table semanticdb-abstract-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 "No tags available from non-file based tables." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (defmethod semanticdb-typecache-file-tags ((table semanticdb-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 "Update the typecache for TABLE, and return the file-tags. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 File-tags are those that belong to this file only, and excludes |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 all included files." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (let* (;(idx (semanticdb-get-table-index table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (cache (semanticdb-get-typecache table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 ;; Make sure our file-tags list is up to date. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (when (not (oref cache filestream)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
329 (let ((tags (semantic-find-tags-by-class 'type table)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
330 (exptags nil)) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (when tags |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (setq tags (semanticdb-typecache-safe-tag-list tags table)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
333 (dolist (T tags) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
334 (push (semanticdb-expand-nested-tag T) exptags)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
335 (oset cache filestream (semanticdb-typecache-merge-streams exptags nil))))) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 ;; Return our cache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (oref cache filestream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (defmethod semanticdb-typecache-include-tags ((table semanticdb-abstract-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 "No tags available from non-file based tables." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (defmethod semanticdb-typecache-include-tags ((table semanticdb-table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 "Update the typecache for TABLE, and return the merged types from the include tags. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 Include-tags are the tags brought in via includes, all merged together into |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 a master list." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (let* ((cache (semanticdb-get-typecache table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 ;; Make sure our file-tags list is up to date. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 (when (not (oref cache includestream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (let (;; Calc the path first. This will have a nice side -effect of |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 ;; getting the cache refreshed if a refresh is needed. Most of the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 ;; time this value is itself cached, so the query is fast. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (incpath (semanticdb-find-translate-path table nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (incstream nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 ;; Get the translated path, and extract all the type tags, then merge |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 ;; them all together. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (dolist (i incpath) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 ;; don't include ourselves in this crazy list. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (when (and i (not (eq i table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 ;; @todo - This eieio fcn can be slow! Do I need it? |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 ;; (semanticdb-table-child-p i) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (setq incstream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (semanticdb-typecache-merge-streams |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 incstream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 ;; Getting the cache from this table will also cause this |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 ;; file to update it's cache from it's decendants. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 ;; In theory, caches are only built for most includes |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 ;; only once (in the loop before this one), so this ends |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 ;; up being super fast as we edit our file. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (copy-sequence |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (semanticdb-typecache-file-tags i)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 ;; Save... |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (oset cache includestream incstream))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 ;; Return our cache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (oref cache includestream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 ;;; Search Routines |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
391 ;; |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
392 ;;;###autoload |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (define-overloadable-function semanticdb-typecache-find (type &optional path find-file-match) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 "Search the typecache for TYPE in PATH. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 If type is a string, split the string, and search for the parts. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 If type is a list, treat the type as a pre-split string. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 PATH can be nil for the current buffer, or a semanticdb table. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 FIND-FILE-MATCH is non-nil to force all found tags to be loaded into a buffer.") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (defun semanticdb-typecache-find-default (type &optional path find-file-match) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 "Default implementation of `semanticdb-typecache-find'. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 TYPE is the datatype to find. |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
105842
diff
changeset
|
403 PATH is the search path, which should be one table object. |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 If FIND-FILE-MATCH is non-nil, then force the file belonging to the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 found tag to be loaded." |
110827
9814473572d4
Fix errors in CEDET 1.0 merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110523
diff
changeset
|
406 (if (not (and (featurep 'semantic/db) semanticdb-current-database)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
407 nil ;; No DB, no search |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
408 (save-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
409 (semanticdb-typecache-find-method (or path semanticdb-current-table) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
410 type find-file-match)))) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (defun semanticdb-typecache-find-by-name-helper (name table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 "Find the tag with NAME in TABLE, which is from a typecache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 If more than one tag has NAME in TABLE, we will prefer the tag that |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 is of class 'type." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 (let* ((names (semantic-find-tags-by-name name table)) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
417 (nmerge (semanticdb-typecache-merge-streams names nil)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
418 (types (semantic-find-tags-by-class 'type nmerge))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
419 (or (car-safe types) (car-safe nmerge)))) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (defmethod semanticdb-typecache-find-method ((table semanticdb-abstract-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 type find-file-match) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 "Search the typecache in TABLE for the datatype TYPE. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 If type is a string, split the string, and search for the parts. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 If type is a list, treat the type as a pre-split string. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 If FIND-FILE-MATCH is non-nil, then force the file belonging to the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 found tag to be loaded." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 ;; convert string to a list. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (when (stringp type) (setq type (semantic-analyze-split-name type))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (when (stringp type) (setq type (list type))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;; Search for the list in our typecache. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (let* ((file (semanticdb-typecache-file-tags table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (inc (semanticdb-typecache-include-tags table)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 (stream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (f-ans nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (i-ans nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (ans nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (notdone t) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (lastfile nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 (thisfile nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 (lastans nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 (calculated-scope nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 ;; 1) Find first symbol in the two master lists and then merge |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 ;; the found streams. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 ;; We stripped duplicates, so these will be super-fast! |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (setq f-ans (semantic-find-first-tag-by-name (car type) file)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (setq i-ans (semantic-find-first-tag-by-name (car type) inc)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (if (and f-ans i-ans) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (progn |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 ;; This trick merges the two identified tags, making sure our lists are |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 ;; complete. The second find then gets the new 'master' from the list of 2. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (setq ans (semanticdb-typecache-merge-streams (list f-ans) (list i-ans))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (setq ans (semantic-find-first-tag-by-name (car type) ans)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 ;; The answers are already sorted and merged, so if one misses, |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 ;; no need to do any special work. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (setq ans (or f-ans i-ans))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 ;; 2) Loop over the remaining parts. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (while (and type notdone) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 ;; For pass > 1, stream will be non-nil, so do a search, otherwise |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 ;; ans is from outside the loop. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (when stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (setq ans (semanticdb-typecache-find-by-name-helper (car type) stream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 ;; NOTE: The below test to make sure we get a type is only relevant |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 ;; for the SECOND pass or later. The first pass can only ever |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 ;; find a type/namespace because everything else is excluded. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 ;; If this is not the last entry from the list, then it |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 ;; must be a type or a namespace. Lets double check. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (when (cdr type) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 ;; From above, there is only one tag in ans, and we prefer |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 ;; types. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 (when (not (semantic-tag-of-class-p ans 'type)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (setq ans nil))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (push ans calculated-scope) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 ;; Track most recent file. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (setq thisfile (semantic-tag-file-name ans)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (when (and thisfile (stringp thisfile)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 (setq lastfile thisfile)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 ;; If we have a miss, exit, otherwise, update the stream to |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 ;; the next set of members. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (if (not ans) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (setq notdone nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 (setq stream (semantic-tag-type-members ans))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (setq lastans ans |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 ans nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 type (cdr type))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (if (or type (not notdone)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 ;; If there is stuff left over, then we failed. Just return |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 ;; nothing. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 nil |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 ;; We finished, so return everything. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (if (and find-file-match lastfile) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 ;; This won't liven up the tag since we have a copy, but |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 ;; we ought to be able to get there and go to the right line. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (find-file-noselect lastfile) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 ;; We don't want to find-file match, so instead lets |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 ;; push the filename onto the return tag. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (when lastans |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (setq lastans (semantic-tag-copy lastans nil lastfile)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 ;; We used to do the below, but we would erroneously be putting |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 ;; attributes on tags being shred with other lists. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 ;;(semantic--tag-put-property lastans :filename lastfile) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (if (and lastans calculated-scope) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 ;; Put our discovered scope into the tag if we have a tag |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
527 (progn |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
528 (require 'semantic/scope) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
529 (semantic-scope-tag-clone-with-scope |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
530 lastans (reverse (cdr calculated-scope)))) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 ;; Else, just return |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 lastans |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 )))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 ;;; BRUTISH Typecache |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 ;; Routines for a typecache that crosses all tables in a given database |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 ;; for a matching major-mode. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (defmethod semanticdb-typecache-for-database ((db semanticdb-project-database) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 &optional mode) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 "Return the typecache for the project database DB. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 If there isn't one, create it. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 " |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 (let ((lmode (or mode major-mode)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 (cache (semanticdb-get-typecache db)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 (stream nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (dolist (table (semanticdb-get-database-tables db)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (when (eq lmode (oref table :major-mode)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (setq stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (semanticdb-typecache-merge-streams |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (copy-sequence |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (semanticdb-typecache-file-tags table)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 (oset cache stream stream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 cache)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 (defun semanticdb-typecache-refresh-for-buffer (buffer) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 "Refresh the typecache for BUFFER." |
105799
3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
564 (with-current-buffer buffer |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 (let* ((tab semanticdb-current-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 ;(idx (semanticdb-get-table-index tab)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (tc (semanticdb-get-typecache tab))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (semanticdb-typecache-file-tags tab) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 (semanticdb-typecache-include-tags tab) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 tc))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 ;;; DEBUG |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (defun semanticdb-typecache-complete-flush () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 "Flush all typecaches referenced by the current buffer." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 (let* ((path (semanticdb-find-translate-path nil nil))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 (dolist (P path) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 (oset P pointmax nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 (semantic-reset (semanticdb-get-typecache P))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 (defun semanticdb-typecache-dump () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 "Dump the typecache for the current buffer." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (let* ((start (current-time)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (tc (semanticdb-typecache-refresh-for-buffer (current-buffer))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (end (current-time)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (data-debug-new-buffer "*TypeCache ADEBUG*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (message "Calculating Cache took %.2f seconds." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 (semantic-elapsed-time start end)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (data-debug-insert-thing tc "]" "") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (defun semanticdb-db-typecache-dump () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 "Dump the typecache for the current buffer's database." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 (require 'data-debug) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 (let* ((tab semanticdb-current-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (idx (semanticdb-get-table-index tab)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 (junk (oset idx type-cache nil)) ;; flush! |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 (start (current-time)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 (tc (semanticdb-typecache-for-database (oref tab parent-db))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (end (current-time)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 (data-debug-new-buffer "*TypeCache ADEBUG*") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 (message "Calculating Cache took %.2f seconds." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 (semantic-elapsed-time start end)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 (data-debug-insert-thing tc "]" "") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
618 (provide 'semantic/db-typecache) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
620 ;; Local variables: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
621 ;; generated-autoload-file: "loaddefs.el" |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
622 ;; generated-autoload-load-name: "semantic/db-typecache" |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
623 ;; End: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104441
diff
changeset
|
624 |
105377 | 625 ;; arch-tag: cd7c37a8-2006-4ead-a037-977ffe7e7624 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 ;;; semanticdb-typecache.el ends here |