1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

cedet/semantic/db-debug.el: Don't require semantic/db-mode, since

semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.

cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.

cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.

cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.

cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.

cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.

cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.

cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el

cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold.  Require semantic/find when compiling.

cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope.  Declare
data-debug-insert-thing and data-debug-new-buffer.

cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
This commit is contained in:
Chong Yidong 2009-08-31 00:45:41 +00:00
parent afa85dfef0
commit 691a065ecb
11 changed files with 127 additions and 54 deletions

View file

@ -26,7 +26,6 @@
(require 'data-debug) (require 'data-debug)
(require 'semantic/db) (require 'semantic/db)
(require 'semantic/db-mode)
(require 'semantic/format) (require 'semantic/format)
;;; Code: ;;; Code:

View file

@ -56,7 +56,6 @@
(require 'eieio-opt) (require 'eieio-opt)
) )
(require 'semantic/db-file) (require 'semantic/db-file)
(require 'semantic/db-mode)
(require 'semantic/find) (require 'semantic/find)
(require 'semantic/sort) (require 'semantic/sort)
(require 'data-debug) (require 'data-debug)

View file

@ -1,4 +1,4 @@
;;; db-el.el --- Semantic database extensions for Emacs Lisp ;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp
;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 ;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;;; Free Software Foundation, Inc. ;;; Free Software Foundation, Inc.
@ -31,7 +31,8 @@
;; to also work in Emacs Lisp with no compromises. ;; to also work in Emacs Lisp with no compromises.
;; ;;
(require 'semantic/db-search) (require 'semantic/db)
(eval-when-compile (eval-when-compile
;; For generic function searching. ;; For generic function searching.
(require 'eieio) (require 'eieio)
@ -340,4 +341,4 @@ Return a list of tags."
(provide 'semantic/db-el) (provide 'semantic/db-el)
;;; semanticdb-el.el ends here ;;; semantic/db-el.el ends here

View file

@ -1,4 +1,4 @@
;;; db-file.el --- Save a semanticdb to a cache file. ;;; semantic/db-file.el --- Save a semanticdb to a cache file.
;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
;;; Free Software Foundation, Inc. ;;; Free Software Foundation, Inc.
@ -147,9 +147,11 @@ If DIRECTORY doesn't exist, create a new one."
db)) db))
;;; File IO ;;; File IO
(declare-function inversion-test "inversion")
(defun semanticdb-load-database (filename) (defun semanticdb-load-database (filename)
"Load the database FILENAME." "Load the database FILENAME."
(require 'inversion)
(condition-case foo (condition-case foo
(let* ((r (eieio-persistent-read filename)) (let* ((r (eieio-persistent-read filename))
(c (semanticdb-get-database-tables r)) (c (semanticdb-get-database-tables r))
@ -160,23 +162,26 @@ If DIRECTORY doesn't exist, create a new one."
(while c (while c
(oset (car c) parent-db r) (oset (car c) parent-db r)
(setq c (cdr c))) (setq c (cdr c)))
(if (not (inversion-test 'semanticdb-file fv)) (unless (and (equal semanticdb-file-version fv)
(when (inversion-test 'semantic-tag tv) (equal semantic-tag-version tv))
;; Incompatible version. Flush tables. ;; Try not to load inversion unless we need it:
(semanticdb-flush-database-tables r) (require 'inversion)
;; Reset the version to new version. (if (not (inversion-test 'semanticdb-file fv))
(oset r semantic-tag-version semantic-tag-version) (when (inversion-test 'semantic-tag tv)
;; Warn user ;; Incompatible version. Flush tables.
(message "Semanticdb file is old. Starting over for %s" (semanticdb-flush-database-tables r)
filename) ;; Reset the version to new version.
) (oset r semantic-tag-version semantic-tag-version)
;; Version is not ok. Flush whole system ;; Warn user
(message "semanticdb file is old. Starting over for %s" (message "Semanticdb file is old. Starting over for %s"
filename) filename))
;; This database is so old, we need to replace it. ;; Version is not ok. Flush whole system
;; We also need to delete it from the instance tracker. (message "semanticdb file is old. Starting over for %s"
(delete-instance r) filename)
(setq r nil)) ;; This database is so old, we need to replace it.
;; We also need to delete it from the instance tracker.
(delete-instance r)
(setq r nil)))
r) r)
(error (message "Cache Error: [%s] %s, Restart" (error (message "Cache Error: [%s] %s, Restart"
filename foo) filename foo)
@ -262,6 +267,8 @@ Live files are either buffers in Emacs, or files existing on the filesystem."
This variable is set to nil after the first error is encountered This variable is set to nil after the first error is encountered
to prevent overload.") to prevent overload.")
(declare-function data-debug-insert-thing "data-debug")
(defmethod object-write ((obj semanticdb-table)) (defmethod object-write ((obj semanticdb-table))
"When writing a table, we have to make sure we deoverlay it first. "When writing a table, we have to make sure we deoverlay it first.
Restore the overlays after writting. Restore the overlays after writting.
@ -435,4 +442,4 @@ Optional NOERROR prevents errors from being displayed."
(provide 'semantic/db-file) (provide 'semantic/db-file)
;;; semanticdb-file.el ends here ;;; semantic/db-file.el ends here

View file

@ -121,7 +121,20 @@
(require 'eieio) (require 'eieio)
) )
(require 'semantic/find)
(require 'semantic/tag-file)
(require 'semantic/sort)
;;; Code: ;;; Code:
(defvar data-debug-thing-alist)
(declare-function data-debug-insert-stuff-list "data-debug")
(declare-function data-debug-insert-tag-list "data-debug")
(declare-function semantic-scope-reset-cache "semantic/scope")
(declare-function semanticdb-typecache-notify-reset "semantic/db-typecache")
(declare-function ede-current-project "ede")
(defvar semanticdb-find-throttle-custom-list (defvar semanticdb-find-throttle-custom-list
'(repeat (radio (const 'local) '(repeat (radio (const 'local)
(const 'project) (const 'project)
@ -132,6 +145,7 @@
"Customization values for semanticdb find throttle. "Customization values for semanticdb find throttle.
See `semanticdb-find-throttle' for details.") See `semanticdb-find-throttle' for details.")
;;;###autoload
(defcustom semanticdb-find-default-throttle (defcustom semanticdb-find-default-throttle
'(local project unloaded system recursive) '(local project unloaded system recursive)
"The default throttle for `semanticdb-find' routines. "The default throttle for `semanticdb-find' routines.
@ -188,6 +202,7 @@ This class will cache data derived during various searches.")
(defmethod semantic-reset ((idx semanticdb-find-search-index)) (defmethod semantic-reset ((idx semanticdb-find-search-index))
"Reset the object IDX." "Reset the object IDX."
(require 'semantic/scope)
;; Clear the include path. ;; Clear the include path.
(oset idx include-path nil) (oset idx include-path nil)
(when (oref idx type-cache) (when (oref idx type-cache)
@ -233,6 +248,7 @@ This class will cache data derived during various searches.")
(let ((tab-idx (semanticdb-get-table-index tab))) (let ((tab-idx (semanticdb-get-table-index tab)))
;; Not a full reset? ;; Not a full reset?
(when (oref tab-idx type-cache) (when (oref tab-idx type-cache)
(require 'db-typecache)
(semanticdb-typecache-notify-reset (semanticdb-typecache-notify-reset
(oref tab-idx type-cache))) (oref tab-idx type-cache)))
))) )))
@ -300,6 +316,13 @@ Default action as described in `semanticdb-find-translate-path'."
(semanticdb-find-translate-path-brutish-default path) (semanticdb-find-translate-path-brutish-default path)
(semanticdb-find-translate-path-includes-default path)))) (semanticdb-find-translate-path-includes-default path))))
(define-overloadable-function semanticdb-find-table-for-include (includetag &optional table)
"For a single INCLUDETAG found in TABLE, find a `semanticdb-table' object
INCLUDETAG is a semantic TAG of class 'include.
TABLE is a semanticdb table that identifies where INCLUDETAG came from.
TABLE is optional if INCLUDETAG has an overlay of :filename attribute."
)
(defun semanticdb-find-translate-path-brutish-default (path) (defun semanticdb-find-translate-path-brutish-default (path)
"Translate PATH into a list of semantic tables. "Translate PATH into a list of semantic tables.
Default action as described in `semanticdb-find-translate-path'." Default action as described in `semanticdb-find-translate-path'."
@ -582,13 +605,6 @@ isn't in memory yet."
"Load an unloaded file in FILENAME using the default semanticdb loader." "Load an unloaded file in FILENAME using the default semanticdb loader."
(semanticdb-file-table-object filename)) (semanticdb-file-table-object filename))
(define-overloadable-function semanticdb-find-table-for-include (includetag &optional table)
"For a single INCLUDETAG found in TABLE, find a `semanticdb-table' object
INCLUDETAG is a semantic TAG of class 'include.
TABLE is a semanticdb table that identifies where INCLUDETAG came from.
TABLE is optional if INCLUDETAG has an overlay of :filename attribute."
)
(defun semanticdb-find-table-for-include-default (includetag &optional table) (defun semanticdb-find-table-for-include-default (includetag &optional table)
"Default implementation of `semanticdb-find-table-for-include'. "Default implementation of `semanticdb-find-table-for-include'.
Uses `semanticdb-current-database-list' as the search path. Uses `semanticdb-current-database-list' as the search path.
@ -1079,7 +1095,6 @@ Returns result."
(semanticdb-find-log-move-to-end))) (semanticdb-find-log-move-to-end)))
;;; Semanticdb find API functions ;;; Semanticdb find API functions
;;
;; These are the routines actually used to perform searches. ;; These are the routines actually used to perform searches.
;; ;;
(defun semanticdb-find-tags-collector (function &optional path find-file-match (defun semanticdb-find-tags-collector (function &optional path find-file-match

View file

@ -29,7 +29,7 @@
;; ;;
(require 'cedet-global) (require 'cedet-global)
(require 'semantic/db-search) (require 'semantic/db-find)
(require 'semantic/symref/global) (require 'semantic/symref/global)
(eval-when-compile (eval-when-compile
@ -37,7 +37,13 @@
(require 'eieio) (require 'eieio)
(require 'eieio-opt) (require 'eieio-opt)
) )
;;; Code: ;;; Code:
(declare-function data-debug-new-buffer "data-debug")
(declare-function data-debug-insert-thing result "data-debug")
(defun semanticdb-enable-gnu-global-databases (mode) (defun semanticdb-enable-gnu-global-databases (mode)
"Enable the use of the GNU Global SemanticDB back end for all files of MODE. "Enable the use of the GNU Global SemanticDB back end for all files of MODE.
This will add an instance of a GNU Global database to each buffer This will add an instance of a GNU Global database to each buffer
@ -67,6 +73,12 @@ in a GNU Global supported hierarchy."
MODE is the major mode to support." MODE is the major mode to support."
(semanticdb-enable-gnu-global-in-buffer t)) (semanticdb-enable-gnu-global-in-buffer t))
(defclass semanticdb-project-database-global
;; @todo - convert to one DB per directory.
(semanticdb-project-database eieio-instance-tracker)
()
"Database representing a GNU Global tags file.")
(defun semanticdb-enable-gnu-global-in-buffer (&optional dont-err-if-not-available) (defun semanticdb-enable-gnu-global-in-buffer (&optional dont-err-if-not-available)
"Enable a GNU Global database in the current buffer. "Enable a GNU Global database in the current buffer.
Argument DONT-ERR-IF-NOT-AVAILABLE will throw an error if GNU Global Argument DONT-ERR-IF-NOT-AVAILABLE will throw an error if GNU Global
@ -94,12 +106,6 @@ is not available for this directory."
) )
"A table for returning search results from GNU Global.") "A table for returning search results from GNU Global.")
(defclass semanticdb-project-database-global
;; @todo - convert to one DB per directory.
(semanticdb-project-database eieio-instance-tracker)
()
"Database representing a GNU Global tags file.")
(defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer) (defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer)
"Return t, pretend that this table's mode is equivalent to BUFFER. "Return t, pretend that this table's mode is equivalent to BUFFER.
Equivalent modes are specified by by `semantic-equivalent-major-modes' Equivalent modes are specified by by `semantic-equivalent-major-modes'

View file

@ -1,4 +1,4 @@
;;; db-javascript.el --- Semantic database extensions for javascript ;;; semantic/db-javascript.el --- Semantic database extensions for javascript
;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 ;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
;;; Free Software Foundation, Inc. ;;; Free Software Foundation, Inc.
@ -29,7 +29,9 @@
;; the list of tags. ;; the list of tags.
;; ;;
(require 'semantic/db-search) (require 'semantic/db)
(require 'semantic/db-find)
(eval-when-compile (eval-when-compile
;; For generic function searching. ;; For generic function searching.
(require 'eieio) (require 'eieio)
@ -305,6 +307,6 @@ Return a list of tags."
;; function encodeURIComponent (uriComponent){} ;; function encodeURIComponent (uriComponent){}
(provide 'semantic/db-el) (provide 'semantic/db-javascript)
;;; semanticdb-el.el ends here ;;; semantic/db-javascript.el ends here

View file

@ -25,13 +25,17 @@
(require 'semantic/db) (require 'semantic/db)
;;; Code: ;;; Code:
(defvar semanticdb-current-database nil
"For a given buffer, this is the currently active database.")
(make-variable-buffer-local 'semanticdb-current-database)
(defvar semanticdb-current-table nil ;; Moved into semantic/db.el:
"For a given buffer, this is the currently active database table.") ;; (defvar semanticdb-current-database nil
(make-variable-buffer-local 'semanticdb-current-table) ;; "For a given buffer, this is the currently active database.")
;; (make-variable-buffer-local 'semanticdb-current-database)
;; (defvar semanticdb-current-table nil
;; "For a given buffer, this is the currently active database table.")
;; (make-variable-buffer-local 'semanticdb-current-table)
(declare-function semantic-lex-spp-set-dynamic-table "semantic/lex-spp")
(defcustom semanticdb-global-mode nil (defcustom semanticdb-global-mode nil
"*If non-nil enable the use of `semanticdb-minor-mode'." "*If non-nil enable the use of `semanticdb-minor-mode'."

View file

@ -1,4 +1,4 @@
;;; db-ref.el --- Handle cross-db file references ;;; semantic/db-ref.el --- Handle cross-db file references
;;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. ;;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
@ -36,6 +36,16 @@
;;; Code: ;;; Code:
(require 'eieio)
(require 'semantic/db)
(require 'semantic/util)
(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) (defmethod semanticdb-add-reference ((dbt semanticdb-abstract-table)
include-tag) include-tag)
"Add a reference for the database table DBT based on INCLUDE-TAG. "Add a reference for the database table DBT based on INCLUDE-TAG.
@ -137,11 +147,17 @@ DBT, the second argument is DBT."
(i-include :initarg :i-include)) (i-include :initarg :i-include))
"Simple class to allow ADEBUG to show a nice list.") "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) (defun semanticdb-ref-test (refresh)
"Dump out the list of references for the current buffer. "Dump out the list of references for the current buffer.
If REFRESH is non-nil, cause the current table to have it's references If REFRESH is non-nil, cause the current table to have it's references
refreshed before dumping the result." refreshed before dumping the result."
(interactive "p") (interactive "p")
(require 'data-debug)
(require 'semantic/db)
;; If we need to refresh... then do so. ;; If we need to refresh... then do so.
(when refresh (when refresh
(semanticdb-refresh-references semanticdb-current-table)) (semanticdb-refresh-references semanticdb-current-table))
@ -158,4 +174,4 @@ refreshed before dumping the result."
) )
(provide 'semantic/db-ref) (provide 'semantic/db-ref)
;;; semanticdb-ref.el ends here ;;; semantic/db-ref.el ends here

View file

@ -30,6 +30,12 @@
(require 'semantic/db) (require 'semantic/db)
(require 'semantic/db-find) (require 'semantic/db-find)
(require 'semantic/tag-ls)
(require 'semantic/analyze/fcn)
(require 'semantic/scope)
(declare-function data-debug-insert-thing "data-debug")
(declare-function data-debug-new-buffer "data-debug")
;;; Code: ;;; Code:

View file

@ -1,4 +1,4 @@
;;; db.el --- Semantic tag database manager ;;; semantic/db.el --- Semantic tag database manager
;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
;;; 2008, 2009 Free Software Foundation, Inc. ;;; 2008, 2009 Free Software Foundation, Inc.
@ -59,6 +59,13 @@ mechanism.")
This can be changed to try out new types of search indicies.") This can be changed to try out new types of search indicies.")
(make-variable-buffer-local 'semanticdb-default-find=index-class) (make-variable-buffer-local 'semanticdb-default-find=index-class)
(defvar semanticdb-current-database nil
"For a given buffer, this is the currently active database.")
(make-variable-buffer-local 'semanticdb-current-database)
(defvar semanticdb-current-table nil
"For a given buffer, this is the currently active database table.")
(make-variable-buffer-local 'semanticdb-current-table)
;;; ABSTRACT CLASSES ;;; ABSTRACT CLASSES
;; ;;
@ -151,6 +158,17 @@ Adds the number of tags in this file to the object print name."
) )
strings))) strings)))
(defclass semanticdb-search-results-table (semanticdb-abstract-table)
( )
"Table used for search results when there is no file or table association.
Examples include search results from external sources such as from
Emacs' own symbol table, or from external libraries.")
(defmethod semanticdb-refresh-table ((obj semanticdb-search-results-table) &optional force)
"If the tag list associated with OBJ is loaded, refresh it.
This will call `semantic-fetch-tags' if that file is in memory."
nil)
;;; Index Cache ;;; Index Cache
;; ;;
(defclass semanticdb-abstract-search-index () (defclass semanticdb-abstract-search-index ()
@ -986,4 +1004,4 @@ If file does not have tags available, then load the file, and create them."
(provide 'semantic/db) (provide 'semantic/db)
;;; semanticdb.el ends here ;;; semantic/db.el ends here