changeset 104441:902d22a2d922

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.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 31 Aug 2009 00:45:41 +0000
parents 8af937a89d62
children b22b44e953cb
files lisp/cedet/semantic/db-debug.el lisp/cedet/semantic/db-ebrowse.el lisp/cedet/semantic/db-el.el lisp/cedet/semantic/db-file.el lisp/cedet/semantic/db-find.el lisp/cedet/semantic/db-global.el lisp/cedet/semantic/db-javascript.el lisp/cedet/semantic/db-mode.el lisp/cedet/semantic/db-ref.el lisp/cedet/semantic/db-typecache.el lisp/cedet/semantic/db.el
diffstat 11 files changed, 127 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/cedet/semantic/db-debug.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-debug.el	Mon Aug 31 00:45:41 2009 +0000
@@ -26,7 +26,6 @@
 
 (require 'data-debug)
 (require 'semantic/db)
-(require 'semantic/db-mode)
 (require 'semantic/format)
 
 ;;; Code:
--- a/lisp/cedet/semantic/db-ebrowse.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-ebrowse.el	Mon Aug 31 00:45:41 2009 +0000
@@ -56,7 +56,6 @@
   (require 'eieio-opt)
   )
 (require 'semantic/db-file)
-(require 'semantic/db-mode)
 (require 'semantic/find)
 (require 'semantic/sort)
 (require 'data-debug)
--- a/lisp/cedet/semantic/db-el.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-el.el	Mon Aug 31 00:45:41 2009 +0000
@@ -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
 ;;; Free Software Foundation, Inc.
@@ -31,7 +31,8 @@
 ;; to also work in Emacs Lisp with no compromises.
 ;;
 
-(require 'semantic/db-search)
+(require 'semantic/db)
+
 (eval-when-compile
   ;; For generic function searching.
   (require 'eieio)
@@ -340,4 +341,4 @@
 
 (provide 'semantic/db-el)
 
-;;; semanticdb-el.el ends here
+;;; semantic/db-el.el ends here
--- a/lisp/cedet/semantic/db-file.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-file.el	Mon Aug 31 00:45:41 2009 +0000
@@ -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
 ;;; Free Software Foundation, Inc.
@@ -147,9 +147,11 @@
     db))
 
 ;;; File IO
+
+(declare-function inversion-test "inversion")
+
 (defun semanticdb-load-database (filename)
   "Load the database FILENAME."
-  (require 'inversion)
   (condition-case foo
       (let* ((r (eieio-persistent-read filename))
 	     (c (semanticdb-get-database-tables r))
@@ -160,23 +162,26 @@
 	(while c
 	  (oset (car c) parent-db r)
 	  (setq c (cdr c)))
-	(if (not (inversion-test 'semanticdb-file fv))
-	    (when (inversion-test 'semantic-tag tv)
-	      ;; Incompatible version.  Flush tables.
-	      (semanticdb-flush-database-tables r)
-	      ;; Reset the version to new version.
-	      (oset r semantic-tag-version semantic-tag-version)
-	      ;; Warn user
-	      (message "Semanticdb file is old.  Starting over for %s"
-		       filename)
-	      )
-	  ;; Version is not ok.  Flush whole system
-	  (message "semanticdb file is old.  Starting over for %s"
-		   filename)
-	  ;; 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))
+	(unless (and (equal semanticdb-file-version fv)
+		     (equal semantic-tag-version tv))
+	  ;; Try not to load inversion unless we need it:
+	  (require 'inversion)
+	  (if (not (inversion-test 'semanticdb-file fv))
+	      (when (inversion-test 'semantic-tag tv)
+		;; Incompatible version.  Flush tables.
+		(semanticdb-flush-database-tables r)
+		;; Reset the version to new version.
+		(oset r semantic-tag-version semantic-tag-version)
+		;; Warn user
+		(message "Semanticdb file is old.  Starting over for %s"
+			 filename))
+	    ;; Version is not ok.  Flush whole system
+	    (message "semanticdb file is old.  Starting over for %s"
+		     filename)
+	    ;; 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)
     (error (message "Cache Error: [%s] %s, Restart"
 		    filename foo)
@@ -262,6 +267,8 @@
 This variable is set to nil after the first error is encountered
 to prevent overload.")
 
+(declare-function data-debug-insert-thing "data-debug")
+
 (defmethod object-write ((obj semanticdb-table))
   "When writing a table, we have to make sure we deoverlay it first.
 Restore the overlays after writting.
@@ -435,4 +442,4 @@
 
 (provide 'semantic/db-file)
 
-;;; semanticdb-file.el ends here
+;;; semantic/db-file.el ends here
--- a/lisp/cedet/semantic/db-find.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-find.el	Mon Aug 31 00:45:41 2009 +0000
@@ -121,7 +121,20 @@
   (require 'eieio)
   )
 
+(require 'semantic/find)
+
+(require 'semantic/tag-file)
+(require 'semantic/sort)
+
 ;;; 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
   '(repeat (radio (const 'local)
 		  (const 'project)
@@ -132,6 +145,7 @@
   "Customization values for semanticdb find throttle.
 See `semanticdb-find-throttle' for details.")
 
+;;;###autoload
 (defcustom semanticdb-find-default-throttle
   '(local project unloaded system recursive)
   "The default throttle for `semanticdb-find' routines.
@@ -188,6 +202,7 @@
 
 (defmethod semantic-reset ((idx semanticdb-find-search-index))
   "Reset the object IDX."
+  (require 'semantic/scope)
   ;; Clear the include path.
   (oset idx include-path nil)
   (when (oref idx type-cache)
@@ -233,6 +248,7 @@
 	   (let ((tab-idx (semanticdb-get-table-index tab)))
 	     ;; Not a full reset?
 	     (when (oref tab-idx type-cache)
+	       (require 'db-typecache)
 	       (semanticdb-typecache-notify-reset
 		(oref tab-idx type-cache)))
 	     )))
@@ -300,6 +316,13 @@
 	(semanticdb-find-translate-path-brutish-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)
   "Translate PATH into a list of semantic tables.
 Default action as described in `semanticdb-find-translate-path'."
@@ -582,13 +605,6 @@
   "Load an unloaded file in FILENAME using the default semanticdb loader."
   (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)
   "Default implementation of `semanticdb-find-table-for-include'.
 Uses `semanticdb-current-database-list' as the search path.
@@ -1079,7 +1095,6 @@
     (semanticdb-find-log-move-to-end)))
 
 ;;; Semanticdb find API functions
-;;
 ;; These are the routines actually used to perform searches.
 ;;
 (defun semanticdb-find-tags-collector (function &optional path find-file-match
--- a/lisp/cedet/semantic/db-global.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-global.el	Mon Aug 31 00:45:41 2009 +0000
@@ -29,7 +29,7 @@
 ;;
 
 (require 'cedet-global)
-(require 'semantic/db-search)
+(require 'semantic/db-find)
 (require 'semantic/symref/global)
 
 (eval-when-compile
@@ -37,7 +37,13 @@
   (require 'eieio)
   (require 'eieio-opt)
   )
+
 ;;; 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)
   "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
@@ -67,6 +73,12 @@
 MODE is the major mode to support."
   (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)
   "Enable a GNU Global database in the current buffer.
 Argument DONT-ERR-IF-NOT-AVAILABLE will throw an error if GNU Global
@@ -94,12 +106,6 @@
    )
   "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)
   "Return t, pretend that this table's mode is equivalent to BUFFER.
 Equivalent modes are specified by by `semantic-equivalent-major-modes'
--- a/lisp/cedet/semantic/db-javascript.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-javascript.el	Mon Aug 31 00:45:41 2009 +0000
@@ -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
 ;;; Free Software Foundation, Inc.
@@ -29,7 +29,9 @@
 ;; the list of tags.
 ;;
 
-(require 'semantic/db-search)
+(require 'semantic/db)
+(require 'semantic/db-find)
+
 (eval-when-compile
   ;; For generic function searching.
   (require 'eieio)
@@ -305,6 +307,6 @@
 ;; function encodeURIComponent (uriComponent){}
 
 
-(provide 'semantic/db-el)
+(provide 'semantic/db-javascript)
 
-;;; semanticdb-el.el ends here
+;;; semantic/db-javascript.el ends here
--- a/lisp/cedet/semantic/db-mode.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-mode.el	Mon Aug 31 00:45:41 2009 +0000
@@ -25,13 +25,17 @@
 
 (require 'semantic/db)
 ;;; Code:
-(defvar semanticdb-current-database nil
-  "For a given buffer, this is the currently active database.")
-(make-variable-buffer-local 'semanticdb-current-database)
+
+;; Moved into semantic/db.el:
+;; (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)
+;; (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
   "*If non-nil enable the use of `semanticdb-minor-mode'."
--- a/lisp/cedet/semantic/db-ref.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-ref.el	Mon Aug 31 00:45:41 2009 +0000
@@ -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.
 
@@ -36,6 +36,16 @@
 
 
 ;;; 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)
 				     include-tag)
   "Add a reference for the database table DBT based on INCLUDE-TAG.
@@ -137,11 +147,17 @@
    (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)
+  (require 'semantic/db)
   ;; If we need to refresh... then do so.
   (when refresh
     (semanticdb-refresh-references semanticdb-current-table))
@@ -158,4 +174,4 @@
   )
 
 (provide 'semantic/db-ref)
-;;; semanticdb-ref.el ends here
+;;; semantic/db-ref.el ends here
--- a/lisp/cedet/semantic/db-typecache.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db-typecache.el	Mon Aug 31 00:45:41 2009 +0000
@@ -30,6 +30,12 @@
 
 (require 'semantic/db)
 (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:
 
--- a/lisp/cedet/semantic/db.el	Mon Aug 31 00:13:42 2009 +0000
+++ b/lisp/cedet/semantic/db.el	Mon Aug 31 00:45:41 2009 +0000
@@ -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,
 ;;; 2008, 2009 Free Software Foundation, Inc.
@@ -59,6 +59,13 @@
 This can be changed to try out new types of search indicies.")
 (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
 ;;
@@ -151,6 +158,17 @@
 		       )
 	       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
 ;;
 (defclass semanticdb-abstract-search-index ()
@@ -986,4 +1004,4 @@
 
 (provide 'semantic/db)
 
-;;; semanticdb.el ends here
+;;; semantic/db.el ends here