Mercurial > emacs
view lisp/cedet/semantic/db-ref.el @ 104444:2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
lisp/emacs-lisp/autoload.el (generated-autoload-feature): New var.
(autoload-rubric): Use it.
lisp/cedet/semantic/adebug.el (data-debug-insert-find-results-button): Require
db-find.
lisp/cedet/semantic/analyze.el: Require semantic/tag. Don't declare
autoloaded functions.
lisp/cedet/semantic/chart.el: Don't declare autoloaded functions.
lisp/cedet/semantic/complete.el: eval-when-compile semantic/find for macro.
(semantic-collector-calculate-completions-raw): Require semantic/db-find.
lisp/cedet/semantic/ctxt.el (semantic-up-context): Require semantic/find.
Don't require it at top-level.
lisp/cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-dump): Require
data-debug. Don't require it at top-level. Don't require semantic/sort.
lisp/cedet/semantic/db-find.el: Add local vars for autoloading.
Don't require semantic/tag-file and semantic/sort.
(semanticdb-find-default-throttle, semanticdb-find-result-length)
(semanticdb-find-result-nth, semanticdb-find-result-nth-in-buffer)
(semanticdb-find-tags-by-name, semanticdb-find-tags-for-completion)
(semanticdb-find-translate-path, semanticdb-find-table-for-include): Autoload.
lisp/cedet/semantic/db-ref.el: Require semantic and semantic/tag.
(semanticdb-ref-test): Require data-debug. Don't require it at
top-level.
lisp/cedet/semantic/db-typecache.el: Require semantic and semantic/tag.
Declare semantic-sort-tags-by-name-then-type-increasing and
semantic-scope-tag-clone-with-scope.
eval-when-compile semantic/find for semantic-find-tags-by-* macros.
Add local vars for autoloading.
(semanticdb-typecache-find): Autoload.
lisp/cedet/semantic/db.el: Add local vars for autoloading.
(semanticdb-current-database, semanticdb-current-table)
(semanticdb-file-table-object): Autoload.
lisp/cedet/semantic/decorate.el: Don't requirements for autoloaded functions.
lisp/cedet/semantic/doc.el: Add local vars for autoloading.
(semantic-documentation-for-tag): Autoload.
lisp/cedet/semantic/edit.el: Drop requirements for autoloaded functions.
lisp/cedet/semantic/find.el: Add local vars for autoloading.
(semantic-current-tag, semantic-find-tag-by-overlay)
(semantic-find-first-tag-by-name): Autoload.
lisp/cedet/semantic/format.el: Add local vars for autoloading.
(semantic-format-tag-name, semantic-format-tag-custom-list)
(semantic-format-tag-functions): Autoload.
lisp/cedet/semantic/fw.el: Require semantic/loaddefs.
lisp/cedet/semantic/html.el (semantic-html-recursive-combobulate-list):
Use assoc-string instead of assoc-case.
lisp/cedet/semantic/ia.el (semantic-ia-insert-tag): Move up to avoid
compiler error.
(semantic-ia-complete-symbol-menu): Require imenu.
(semantic-ia-fast-jump): Require semantic/decorate/include.
lisp/cedet/semantic/idle.el: Require semantic and semantic/tag.
Declare semanticdb-typecache-refresh-for-buffer and eldoc-message.
eval-when-compile semantic/find for semantic-find-tags-by-name macro.
lisp/cedet/semantic/sort.el: Add local vars for autoloading.
(semantic-flatten-tags-table, semantic-tag-external-member-parent):
Autoload.
lisp/cedet/semantic/tag-file.el: Add local vars for autoloading.
(semantic-go-to-tag, semantic-dependency-tag-file): Autoload.
lisp/cedet/semantic/tag-ls.el: Add local vars for autoloading.
(semantic-tag-prototype-p): Autoload.
lisp/cedet/semantic/tag.el: Don't declare autoloaded functions.
lisp/cedet/semantic/analyze/complete.el: Add local variables for autoloading.
(semantic-analyze-possible-completions): Autoload.
lisp/cedet/semantic/analyze/fcn.el: Require mode-local.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 02 Sep 2009 04:37:10 +0000 |
parents | 902d22a2d922 |
children | 6065d66f0c99 |
line wrap: on
line source
;;; semantic/db-ref.el --- Handle cross-db file references ;;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam <eric@siege-engine.com> ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; ;; Handle cross-database file references. ;; ;; Any given database may be referred to by some other database. For ;; example, if a .cpp file has a #include in a header, then that ;; header file should have a reference to the .cpp file that included ;; it. ;; ;; This is critical for purposes where a file (such as a .cpp file) ;; needs to have its caches flushed because of changes in the ;; header. Changing a header may cause a referring file to be ;; reparsed due to account for changes in defined macros, or perhaps ;; a change to files the header includes. ;;; Code: (require 'eieio) (require 'semantic) (require 'semantic/tag) (defvar semanticdb-find-default-throttle) ;; For the semantic-find-tags-by-name-regexp macro. (eval-when-compile (require 'semantic/find)) (defvar semantic-case-fold) (defmethod semanticdb-add-reference ((dbt semanticdb-abstract-table) include-tag) "Add a reference for the database table DBT based on INCLUDE-TAG. DBT is the database table that owns the INCLUDE-TAG. The reference will be added to the database that INCLUDE-TAG refers to." ;; NOTE: I should add a check to make sure include-tag is in DB. ;; but I'm too lazy. (let* ((semanticdb-find-default-throttle (if (featurep 'semanticdb-find) (remq 'unloaded semanticdb-find-default-throttle) nil)) (refdbt (semanticdb-find-table-for-include include-tag dbt)) ;;(fullfile (semanticdb-full-filename dbt)) ) (when refdbt ;; Add our filename (full path) ;; (object-add-to-list refdbt 'file-refs fullfile) ;; Add our database. (object-add-to-list refdbt 'db-refs dbt) t))) (defmethod semanticdb-check-references ((dbt semanticdb-abstract-table)) "Check and cleanup references in the database DBT. Abstract tables would be difficult to reference." ;; Not sure how an abstract table can have references. nil) (defmethod semanticdb-includes-in-table ((dbt semanticdb-abstract-table)) "Return a list of direct includes in table DBT." (semantic-find-tags-by-class 'include (semanticdb-get-tags dbt))) (defmethod semanticdb-check-references ((dbt semanticdb-table)) "Check and cleanup references in the database DBT. Any reference to a file that cannot be found, or whos file no longer refers to DBT will be removed." (let ((refs (oref dbt db-refs)) (myexpr (concat "\\<" (oref dbt file))) ) (while refs (let* ((ok t) (db (car refs)) (f (when (semanticdb-table-child-p db) (semanticdb-full-filename db))) ) ;; The file was deleted (when (and f (not (file-exists-p f))) (setq ok nil)) ;; The reference no longer includes the textual reference? (let* ((refs (semanticdb-includes-in-table db)) (inc (semantic-find-tags-by-name-regexp myexpr refs))) (when (not inc) (setq ok nil))) ;; Remove not-ok databases from the list. (when (not ok) (object-remove-from-list dbt 'db-refs db) )) (setq refs (cdr refs))))) (defmethod semanticdb-refresh-references ((dbt semanticdb-abstract-table)) "Refresh references to DBT in other files." ;; alternate tables can't be edited, so can't be changed. nil ) (defmethod semanticdb-refresh-references ((dbt semanticdb-table)) "Refresh references to DBT in other files." (let ((refs (semanticdb-includes-in-table dbt)) ) (while refs (if (semanticdb-add-reference dbt (car refs)) nil ;; If we succeeded, then do... nothing? nil ) (setq refs (cdr refs))) )) (defmethod semanticdb-notify-references ((dbt semanticdb-table) method) "Notify all references of the table DBT using method. METHOD takes two arguments. (METHOD TABLE-TO-NOTIFY DBT) TABLE-TO-NOTIFY is a semanticdb-table which is being notified. DBT, the second argument is DBT." (mapc (lambda (R) (funcall method R dbt)) (oref dbt db-refs))) ;;; DEBUG ;; (defclass semanticdb-ref-adebug () ((i-depend-on :initarg :i-depend-on) (local-table :initarg :local-table) (i-include :initarg :i-include)) "Simple class to allow ADEBUG to show a nice list.") (defvar semanticdb-current-table) (declare-function data-debug-new-buffer "data-debug") (declare-function data-debug-insert-object-slots "data-debug") (defun semanticdb-ref-test (refresh) "Dump out the list of references for the current buffer. If REFRESH is non-nil, cause the current table to have it's references refreshed before dumping the result." (interactive "p") (require 'data-debug) ;; If we need to refresh... then do so. (when refresh (semanticdb-refresh-references semanticdb-current-table)) ;; Do the debug system (let* ((tab semanticdb-current-table) (myrefs (oref tab db-refs)) (myinc (semanticdb-includes-in-table tab)) (adbc (semanticdb-ref-adebug "DEBUG" :i-depend-on myrefs :local-table tab :i-include myinc))) (data-debug-new-buffer "*References ADEBUG*") (data-debug-insert-object-slots adbc "!")) ) (provide 'semantic/db-ref) ;;; semantic/db-ref.el ends here