1 ;;; semantic/db-find.el --- Searching through semantic databases.
3 ;; Copyright (C) 2000-2014 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; Databases of various forms can all be searched.
26 ;; There are a few types of searches that can be done:
29 ;; These searches scan a database table collection for tags based
32 ;; Basic Attribute Search:
33 ;; These searches allow searching on specific attributes of tags,
34 ;; such as name, type, or other attribute.
37 ;; These are searches that were needed to accomplish some
38 ;; specialized tasks as discovered in utilities. Advanced searches
39 ;; include matching methods defined outside some parent class.
41 ;; The reason for advanced searches are so that external
42 ;; repositories such as the Emacs obarray, or java .class files can
43 ;; quickly answer these needed questions without dumping the entire
44 ;; symbol list into Emacs for additional refinement searches via
45 ;; regular semanticdb search.
47 ;; How databases are decided upon is another important aspect of a
48 ;; database search. When it comes to searching for a name, there are
49 ;; these types of searches:
52 ;; Basic search means that tags looking for a given name start
53 ;; with a specific search path. Names are sought on that path
54 ;; until it is empty or items on the path can no longer be found.
55 ;; Use `semanticdb-dump-all-table-summary' to test this list.
56 ;; Use `semanticdb-find-throttle-custom-list' to refine this list.
59 ;; A deep search will search more than just the global namespace.
60 ;; It will recurse into tags that contain more tags, and search
64 ;; Brute search means that all tables in all databases in a given
65 ;; project are searched. Brute searches are the search style as
66 ;; written for semantic version 1.x.
68 ;; How does the search path work?
70 ;; A basic search starts with three parameters:
72 ;; (FINDME &optional PATH FIND-FILE-MATCH)
74 ;; FINDME is key to be searched for dependent on the type of search.
75 ;; PATH is an indicator of which tables are to be searched.
76 ;; FIND-FILE-MATCH indicates that any time a match is found, the
77 ;; file associated with the tag should be read into a file.
79 ;; The PATH argument is then the most interesting argument. It can
82 ;; nil - Take the current buffer, and use its include list
83 ;; buffer - Use that buffer's include list.
84 ;; filename - Use that file's include list. If the file is not
85 ;; in a buffer, see of there is a semanticdb table for it. If
86 ;; not, read that file into a buffer.
87 ;; tag - Get that tag's buffer of file file. See above.
88 ;; table - Search that table, and its include list.
92 ;; Semanticdb returns the results in a specific format. There are a
93 ;; series of routines for using those results, and results can be
94 ;; passed in as a search-path for refinement searches with
95 ;; semanticdb. Apropos for semanticdb.*find-result for more.
99 ;; Here are applications where different searches are needed which
100 ;; exist as of semantic 1.4.x
102 ;; eldoc - popup help
103 ;; => Requires basic search using default path. (Header files ok)
104 ;; tag jump - jump to a named tag
105 ;; => Requires a brute search using whole project. (Source files only)
106 ;; completion - Completing symbol names in a smart way
107 ;; => Basic search (headers ok)
108 ;; type analysis - finding type definitions for variables & fcns
109 ;; => Basic search (headers ok)
110 ;; Class browser - organize types into some structure
111 ;; => Brute search, or custom navigation.
114 ;; During a search, load any unloaded DB files based on paths in the
117 (require 'semantic
/db
)
118 (require 'semantic
/db-ref
)
120 (require 'semantic
/find
))
124 (defvar data-debug-thing-alist
)
125 (declare-function data-debug-insert-stuff-list
"data-debug")
126 (declare-function data-debug-new-buffer
"data-debug")
127 ;;;(declare-function data-debug-insert-tag-list "adebug")
128 (declare-function semantic-scope-reset-cache
"semantic/scope")
129 (declare-function semanticdb-typecache-notify-reset
"semantic/db-typecache")
130 (declare-function ede-current-project
"ede")
132 (defvar semanticdb-find-throttle-custom-list
139 "Customization values for semanticdb find throttle.
140 See `semanticdb-find-throttle' for details.")
143 (defcustom semanticdb-find-default-throttle
144 '(local project unloaded system recursive
)
145 "The default throttle for `semanticdb-find' routines.
146 The throttle controls how detailed the list of database
147 tables is for a symbol lookup. The value is a list with
149 `file' - The file the search is being performed from.
150 This option is here for completeness only, and
151 is assumed to always be on.
152 `local' - Tables from the same local directory are included.
153 This includes files directly referenced by a file name
154 which might be in a different directory.
155 `project' - Tables from the same local project are included
156 If `project' is specified, then `local' is assumed.
157 `unloaded' - If a table is not in memory, load it. If it is not cached
158 on disk either, get the source, parse it, and create
160 `system' - Tables from system databases. These are specifically
161 tables from system header files, or language equivalent.
162 `recursive' - For include based searches, includes tables referenced
164 `omniscience' - Included system databases which are omniscience, or
165 somehow know everything. Omniscience databases are found
166 in `semanticdb-project-system-databases'.
167 The Emacs Lisp system DB is an omniscience database."
169 :type semanticdb-find-throttle-custom-list
)
171 (make-variable-buffer-local 'semanticdb-find-default-throttle
)
173 (defun semanticdb-find-throttle-active-p (access-type)
174 "Non-nil if ACCESS-TYPE is an active throttle type."
175 (or (memq access-type semanticdb-find-default-throttle
)
176 (eq access-type
'file
)
177 (and (eq access-type
'local
)
178 (memq 'project semanticdb-find-default-throttle
))
183 ;; The find routines spend a lot of time looking stuff up.
184 ;; Use this handy search index to cache data between searches.
185 ;; This should allow searches to start running faster.
186 (defclass semanticdb-find-search-index
(semanticdb-abstract-search-index)
187 ((include-path :initform nil
189 "List of semanticdb tables from the include path.")
190 (type-cache :initform nil
192 "Cache of all the data types accessible from this file.
193 Includes all types from all included files, merged namespaces, and
194 expunge duplicates.")
196 "Concrete search index for `semanticdb-find'.
197 This class will cache data derived during various searches.")
199 (defmethod semantic-reset ((idx semanticdb-find-search-index
))
200 "Reset the object IDX."
201 (require 'semantic
/scope
)
202 ;; Clear the include path.
203 (oset idx include-path nil
)
204 (when (oref idx type-cache
)
205 (semantic-reset (oref idx type-cache
)))
206 ;; Clear the scope. Scope doesn't have the data it needs to track
208 (semantic-scope-reset-cache)
211 (defmethod semanticdb-synchronize ((idx semanticdb-find-search-index
)
213 "Synchronize the search index IDX with some NEW-TAGS."
216 ;; Notify dependants by clearing their indices.
217 (semanticdb-notify-references
220 (semantic-reset (semanticdb-get-table-index tab
))))
223 (defmethod semanticdb-partial-synchronize ((idx semanticdb-find-search-index
)
225 "Synchronize the search index IDX with some changed NEW-TAGS."
226 ;; Only reset if include statements changed.
227 (if (semantic-find-tags-by-class 'include new-tags
)
230 ;; Notify dependants by clearing their indices.
231 (semanticdb-notify-references
234 (semantic-reset (semanticdb-get-table-index tab
))))
236 ;; Else, not an include, by just a type.
237 (when (oref idx type-cache
)
238 (when (semanticdb-partial-synchronize (oref idx type-cache
) new-tags
)
239 ;; If the synchronize returns true, we need to notify.
240 ;; Notify dependants by clearing their indices.
241 (semanticdb-notify-references
244 (let ((tab-idx (semanticdb-get-table-index tab
)))
246 (when (oref tab-idx type-cache
)
247 (require 'semantic
/db-typecache
)
248 (semanticdb-typecache-notify-reset
249 (oref tab-idx type-cache
)))
255 ;;; Path Translations
257 ;;; OVERLOAD Functions
259 ;; These routines needed to be overloaded by specific language modes.
260 ;; They are needed for translating an INCLUDE tag into a semanticdb
263 (define-overloadable-function semanticdb-find-translate-path
(path brutish
)
264 "Translate PATH into a list of semantic tables.
265 Path translation involves identifying the PATH input argument
266 in one of the following ways:
267 nil - Take the current buffer, and use its include list
268 buffer - Use that buffer's include list.
269 filename - Use that file's include list. If the file is not
270 in a buffer, see of there is a semanticdb table for it. If
271 not, read that file into a buffer.
272 tag - Get that tag's buffer of file file. See above.
273 table - Search that table, and its include list.
274 find result - Search the results of a previous find.
276 In addition, once the base path is found, there is the possibility of
277 each added table adding yet more tables to the path, so this routine
278 can return a lengthy list.
280 If argument BRUTISH is non-nil, then instead of using the include
281 list, use all tables found in the parent project of the table
282 identified by translating PATH. Such searches use brute force to
283 scan every available table.
285 The return value is a list of objects of type `semanticdb-table' or
286 their children. In the case of passing in a find result, the result
287 is returned unchanged.
289 This routine uses `semanticdb-find-table-for-include' to translate
290 specific include tags into a semanticdb table.
292 Note: When searching using a non-brutish method, the list of
293 included files will be cached between runs. Database-references
294 are used to track which files need to have their include lists
295 refreshed when things change. See `semanticdb-ref-test'.
297 Note for overloading: If you opt to overload this function for your
298 major mode, and your routine takes a long time, be sure to call
300 (semantic-throw-on-input 'your-symbol-here)
302 so that it can be called from the idle work handler."
305 (defun semanticdb-find-translate-path-default (path brutish
)
306 "Translate PATH into a list of semantic tables.
307 If BRUTISH is non nil, return all tables associated with PATH.
308 Default action as described in `semanticdb-find-translate-path'."
309 (if (semanticdb-find-results-p path
)
310 ;; nil means perform the search over these results.
313 (semanticdb-find-translate-path-brutish-default path
)
314 (semanticdb-find-translate-path-includes-default path
))))
317 (define-overloadable-function semanticdb-find-table-for-include
(includetag &optional table
)
318 "For a single INCLUDETAG found in TABLE, find a `semanticdb-table' object
319 INCLUDETAG is a semantic TAG of class 'include.
320 TABLE is a semanticdb table that identifies where INCLUDETAG came from.
321 TABLE is optional if INCLUDETAG has an overlay of :filename attribute."
324 (defun semanticdb-find-translate-path-brutish-default (path)
325 "Translate PATH into a list of semantic tables.
326 Default action as described in `semanticdb-find-translate-path'."
328 (cond ((null path
) semanticdb-current-database
)
329 ((semanticdb-table-p path
) (oref path parent-db
))
330 (t (let ((tt (semantic-something-to-tag-table path
)))
332 ;; @todo - What does this DO ??!?!
333 (with-current-buffer (semantic-tag-buffer (car tt
))
334 semanticdb-current-database
)
335 semanticdb-current-database
))))))
340 (let ((tabs (semanticdb-get-database-tables db
))
342 ;; Only return tables of the same language (major-mode)
343 ;; as the current search environment.
346 (semantic-throw-on-input 'translate-path-brutish
)
348 (if (semanticdb-equivalent-mode-for-search (car tabs
)
350 (setq ret
(cons (car tabs
) ret
)))
351 (setq tabs
(cdr tabs
)))
354 ;; This should scan the current project directory list for all
355 ;; semanticdb files, perhaps handling proxies for them.
356 (semanticdb-current-database-list
357 (if basedb
(oref basedb reference-directory
)
358 default-directory
))))
361 (defun semanticdb-find-incomplete-cache-entries-p (cache)
362 "Are there any incomplete entries in CACHE?"
365 (when (and (semanticdb-table-child-p tab
)
366 (not (number-or-marker-p (oref tab pointmax
))))
371 (defun semanticdb-find-need-cache-update-p (table)
372 "Non-nil if the semanticdb TABLE cache needs to be updated."
373 ;; If we were passed in something related to a TABLE,
374 ;; do a caching lookup.
375 (let* ((index (semanticdb-get-table-index table
))
376 (cache (when index
(oref index include-path
)))
377 (incom (semanticdb-find-incomplete-cache-entries-p cache
))
378 (unl (semanticdb-find-throttle-active-p 'unloaded
))
381 cache
;; Must have a cache
383 ;; If all entries are "full", or if 'unloaded
385 ;; is not in the throttle, it is ok to use the cache.
386 (not incom
) (not unl
)
392 ;; We need an update.
396 (defun semanticdb-find-translate-path-includes-default (path)
397 "Translate PATH into a list of semantic tables.
398 Default action as described in `semanticdb-find-translate-path'."
399 (let ((table (cond ((null path
)
400 semanticdb-current-table
)
402 (semantic-buffer-local-value 'semanticdb-current-table path
))
403 ((and (stringp path
) (file-exists-p path
))
404 (semanticdb-file-table-object path t
))
405 ((semanticdb-abstract-table-child-p path
)
409 ;; If we were passed in something related to a TABLE,
410 ;; do a caching lookup.
411 (let ((index (semanticdb-get-table-index table
)))
412 (if (semanticdb-find-need-cache-update-p table
)
413 ;; Let's go look up our indices.
414 (let ((ans (semanticdb-find-translate-path-includes--internal path
)))
415 (oset index include-path ans
)
416 ;; Once we have our new indices set up, notify those
417 ;; who depend on us if we found something for them to
419 (when ans
(semanticdb-refresh-references table
))
423 ;; Just return the cache.
424 (oref index include-path
)))
425 ;; If we were passed in something like a tag list, or other boring
426 ;; searchable item, then instead do the regular thing without caching.
427 (semanticdb-find-translate-path-includes--internal path
))))
429 (defvar semanticdb-find-lost-includes nil
430 "Include files that we cannot find associated with this buffer.")
431 (make-variable-buffer-local 'semanticdb-find-lost-includes
)
433 (defvar semanticdb-find-scanned-include-tags nil
434 "All include tags scanned, plus action taken on the tag.
435 Each entry is an alist:
437 where ACTION is one of 'scanned, 'duplicate, 'lost
438 and TAG is a clone of the include tag that was found.")
439 (make-variable-buffer-local 'semanticdb-find-scanned-include-tags
)
441 (defvar semanticdb-implied-include-tags nil
442 "Include tags implied for all files of a given mode.
443 Set this variable with `defvar-mode-local' for a particular mode so
444 that any symbols that exist for all files for that mode are included.
446 Note: This could be used as a way to write a file in a language
447 to declare all the built-ins for that language.")
449 (defun semanticdb-find-translate-path-includes--internal (path)
450 "Internal implementation of `semanticdb-find-translate-path-includes-default'.
451 This routine does not depend on the cache, but will always derive
452 a new path from the provided PATH."
453 (let ((includetags nil
)
455 (matchedtables (list semanticdb-current-table
))
456 (matchedincludes nil
)
458 (scannedincludes nil
)
462 (semantic-refresh-tags-safe)
463 (setq includetags
(append
464 (semantic-find-tags-included (current-buffer))
465 semanticdb-implied-include-tags
)
466 curtable semanticdb-current-table
467 incfname
(buffer-file-name))
469 ((semanticdb-table-p path
)
470 (setq includetags
(semantic-find-tags-included path
)
472 incfname
(semanticdb-full-filename path
))
475 (with-current-buffer path
476 (semantic-refresh-tags-safe))
477 (setq includetags
(semantic-find-tags-included path
)
478 curtable
(with-current-buffer path
479 semanticdb-current-table
)
480 incfname
(buffer-file-name path
)))
482 (setq includetags
(semantic-find-tags-included path
))
484 ;; If we have some tags, derive a table from them.
485 ;; else we will do nothing, so the table is useless.
487 ;; @todo - derive some tables
488 (message "Need to derive tables for %S in translate-path-includes--default."
492 ;; Make sure each found include tag has an originating file name associated
495 (dolist (it includetags
)
496 (semantic--tag-put-property it
:filename incfname
)))
498 ;; Loop over all include tags adding to matchedtables
500 (semantic-throw-on-input 'semantic-find-translate-path-includes-default
)
502 ;; If we've seen this include string before, lets skip it.
503 (if (member (semantic-tag-name (car includetags
)) matchedincludes
)
506 (push (cons 'duplicate
(semantic-tag-clone (car includetags
)))
509 (setq nexttable
(semanticdb-find-table-for-include (car includetags
) curtable
))
510 (when (not nexttable
)
511 ;; Save the lost include.
512 (push (car includetags
) lostincludes
)
513 (push (cons 'lost
(semantic-tag-clone (car includetags
)))
518 ;; Push the include file, so if we can't find it, we only
519 ;; can't find it once.
520 (push (semantic-tag-name (car includetags
)) matchedincludes
)
522 ;; (message "Scanning %s" (semantic-tag-name (car includetags)))
524 (not (memq nexttable matchedtables
))
525 (semanticdb-equivalent-mode-for-search nexttable
528 ;; Add to list of tables
529 (push nexttable matchedtables
)
531 ;; Queue new includes to list
532 (if (semanticdb-find-throttle-active-p 'recursive
)
533 ;; @todo - recursive includes need to have the originating
534 ;; buffer's location added to the path.
537 ((semanticdb-table-p nexttable
)
538 (semanticdb-refresh-table nexttable
)
539 ;; Use the method directly, or we will recurse
540 ;; into ourselves here.
541 (semanticdb-find-tags-by-class-method
543 (t ;; @todo - is this ever possible???
544 (message "semanticdb-ftp - how did you do that?")
545 (semantic-find-tags-included
546 (semanticdb-get-tags nexttable
)))
548 (newincfname (semanticdb-full-filename nexttable
))
551 (push (cons 'scanned
(semantic-tag-clone (car includetags
)))
554 ;; Setup new tags so we know where they are.
556 (semantic--tag-put-property it
:filename
559 (setq includetags
(nconc includetags newtags
)))
560 ;; ELSE - not recursive throttle
561 (push (cons 'scanned-no-recurse
562 (semantic-tag-clone (car includetags
)))
566 (setq includetags
(cdr includetags
)))
568 (setq semanticdb-find-lost-includes lostincludes
)
569 (setq semanticdb-find-scanned-include-tags
(reverse scannedincludes
))
571 ;; Find all the omniscient databases for this major mode, and
572 ;; add them if needed
573 (when (and (semanticdb-find-throttle-active-p 'omniscience
)
574 semanticdb-search-system-databases
)
575 ;; We can append any mode-specific omniscience databases into
576 ;; our search list here.
577 (let ((systemdb semanticdb-project-system-databases
)
580 (setq ans
(semanticdb-file-table
582 ;; I would expect most omniscient to return the same
583 ;; thing regardless of filename, but we may have
584 ;; one that can return a table of all things the
585 ;; current file needs.
586 (buffer-file-name (current-buffer))))
587 (when (not (memq ans matchedtables
))
588 (setq matchedtables
(cons ans matchedtables
)))
589 (setq systemdb
(cdr systemdb
))))
591 (nreverse matchedtables
)))
593 (define-overloadable-function semanticdb-find-load-unloaded
(filename)
594 "Create a database table for FILENAME if it hasn't been parsed yet.
595 Assumes that FILENAME exists as a source file.
596 Assumes that a preexisting table does not exist, even if it
597 isn't in memory yet."
598 (if (semanticdb-find-throttle-active-p 'unloaded
)
600 (semanticdb-file-table-object filename t
)))
602 (defun semanticdb-find-load-unloaded-default (filename)
603 "Load an unloaded file in FILENAME using the default semanticdb loader."
604 (semanticdb-file-table-object filename
))
606 ;; The creation of the overload occurs above.
607 (defun semanticdb-find-table-for-include-default (includetag &optional table
)
608 "Default implementation of `semanticdb-find-table-for-include'.
609 Uses `semanticdb-current-database-list' as the search path.
610 INCLUDETAG and TABLE are documented in `semanticdb-find-table-for-include'.
611 Included databases are filtered based on `semanticdb-find-default-throttle'."
612 (if (not (eq (semantic-tag-class includetag
) 'include
))
613 (signal 'wrong-type-argument
(list includetag
'include
)))
616 ;; Note, some languages (like Emacs or Java) use include tag names
617 ;; that don't represent files! We want to have file names.
618 (semantic-tag-include-filename includetag
))
624 ;; INCLUDETAG should have some way to reference where it came
625 ;; from! If not, TABLE should provide the way. Each time we
626 ;; look up a tag, we may need to find it in some relative way
627 ;; and must set our current buffer eto the origin of includetag
628 ;; or nothing may work.
630 (cond ((semantic-tag-file-name includetag
)
631 ;; A tag may have a buffer, or a :filename property.
632 (file-name-directory (semantic-tag-file-name includetag
)))
634 (file-name-directory (semanticdb-full-filename table
)))
636 ;; @todo - what to do here? Throw an error maybe
637 ;; and fix usage bugs?
641 ;; Step 1: Relative path name
643 ;; If the name is relative, then it should be findable as relative
644 ;; to the source file that this tag originated in, and be fast.
646 ((and (semanticdb-find-throttle-active-p 'local
)
647 (file-exists-p (expand-file-name name originfiledir
)))
649 (setq ans
(semanticdb-find-load-unloaded
650 (expand-file-name name originfiledir
)))
652 ;; Step 2: System or Project level includes
655 ;; First, if it a system include, we can investigate that tags
657 (and (semanticdb-find-throttle-active-p 'system
)
659 ;; Sadly, not all languages make this distinction.
660 ;;(semantic-tag-include-system-p includetag)
662 ;; Here, we get local and system files.
663 (setq tmp
(semantic-dependency-tag-file includetag
))
665 ;; Second, project files are active, we and we have EDE,
666 ;; we can find it using the same tool.
667 (and (semanticdb-find-throttle-active-p 'project
)
668 ;; Make sure EDE is available, and we have a project
669 (featurep 'ede
) (ede-current-project originfiledir
)
670 ;; The EDE query is hidden in this call.
671 (setq tmp
(semantic-dependency-tag-file includetag
))
674 (setq ans
(semanticdb-find-load-unloaded tmp
))
676 ;; Somewhere in our project hierarchy
678 ;; Remember: Roots includes system databases which can create
679 ;; specialized tables we can search.
681 ;; NOTE: Not used if EDE is active!
682 ((and (semanticdb-find-throttle-active-p 'project
)
683 ;; And don't do this if it is a system include. Not supported by all languages,
684 ;; but when it is, this is a nice fast way to skip this step.
685 (not (semantic-tag-include-system-p includetag
))
686 ;; Don't do this if we have an EDE project.
687 (not (and (featurep 'ede
)
688 ;; Note: We don't use originfiledir here because
689 ;; we want to know about the source file we are
691 (ede-current-project)))
694 (setq roots
(semanticdb-current-database-list))
696 (while (and (not ans
) roots
)
697 (let* ((ref (if (slot-boundp (car roots
) 'reference-directory
)
698 (oref (car roots
) reference-directory
)))
699 (fname (cond ((null ref
) nil
)
700 ((file-exists-p (expand-file-name name ref
))
701 (expand-file-name name ref
))
702 ((file-exists-p (expand-file-name (file-name-nondirectory name
) ref
))
703 (expand-file-name (file-name-nondirectory name
) ref
)))))
704 (when (and ref fname
)
705 ;; There is an actual file. Grab it.
706 (setq ans
(semanticdb-find-load-unloaded fname
)))
710 ;; NOTE: We used to look up omniscient databases here, but that
711 ;; is now handled one layer up.
713 ;; Missing: a database that knows where missing files are. Hmm.
714 ;; perhaps I need an override function for that?
718 (setq roots
(cdr roots
))))
723 ;;; Perform interactive tests on the path/search mechanisms.
726 (defun semanticdb-find-test-translate-path (&optional arg
)
727 "Call and output results of `semanticdb-find-translate-path'.
728 With ARG non-nil, specify a BRUTISH translation.
729 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
730 for details on how this list is derived."
732 (semantic-fetch-tags)
733 (require 'data-debug
)
734 (let ((start (current-time))
735 (p (semanticdb-find-translate-path nil arg
))
738 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
739 (message "Search of tags took %.2f seconds."
740 (semantic-elapsed-time start end
))
742 (data-debug-insert-stuff-list p
"*")))
744 (defun semanticdb-find-test-translate-path-no-loading (&optional arg
)
745 "Call and output results of `semanticdb-find-translate-path'.
746 With ARG non-nil, specify a BRUTISH translation.
747 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
748 for details on how this list is derived."
750 (semantic-fetch-tags)
751 (require 'data-debug
)
752 (let* ((semanticdb-find-default-throttle
753 (if (featurep 'semantic
/db-find
)
754 (remq 'unloaded semanticdb-find-default-throttle
)
756 (start (current-time))
757 (p (semanticdb-find-translate-path nil arg
))
760 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
761 (message "Search of tags took %.2f seconds."
762 (semantic-elapsed-time start end
))
764 (data-debug-insert-stuff-list p
"*")))
767 (defun semanticdb-find-adebug-lost-includes ()
768 "Translate the current path, then display the lost includes.
769 Examines the variable `semanticdb-find-lost-includes'."
771 (require 'data-debug
)
772 (semanticdb-find-translate-path nil nil
)
773 (let ((lost semanticdb-find-lost-includes
)
777 (message "There are no unknown includes for %s"
780 (data-debug-new-buffer "*SEMANTICDB lost-includes ADEBUG*")
781 ;; (data-debug-insert-tag-list lost "*")
784 (defun semanticdb-find-adebug-insert-scanned-tag-cons (consdata prefix prebuttontext
)
785 "Insert a button representing scanned include CONSDATA.
786 PREFIX is the text that precedes the button.
787 PREBUTTONTEXT is some text between prefix and the overlay button."
788 (let* ((start (point))
790 (mode (car consdata
))
792 (name (semantic-tag-name tag
))
793 (file (semantic-tag-file-name tag
))
794 (str1 (format "%S %s" mode name
))
795 (str2 (format " : %s" file
))
797 (insert prefix prebuttontext str1
)
800 (put-text-property start end
'face
801 (cond ((eq mode
'scanned
)
802 'font-lock-function-name-face
)
803 ((eq mode
'duplicate
)
804 'font-lock-comment-face
)
806 'font-lock-variable-name-face
)
807 ((eq mode
'scanned-no-recurse
)
808 'font-lock-type-face
)))
809 (put-text-property start end
'ddebug
(cdr consdata
))
810 (put-text-property start end
'ddebug-indent
(length prefix
))
811 (put-text-property start end
'ddebug-prefix prefix
)
812 (put-text-property start end
'help-echo tip
)
813 (put-text-property start end
'ddebug-function
814 'data-debug-insert-tag-parts-from-point
)
819 (defun semanticdb-find-adebug-scanned-includes ()
820 "Translate the current path, then display the lost includes.
821 Examines the variable `semanticdb-find-lost-includes'."
823 (require 'data-debug
)
824 (semanticdb-find-translate-path nil nil
)
825 (let ((scanned semanticdb-find-scanned-include-tags
)
826 (data-debug-thing-alist
828 '((lambda (thing) (and (consp thing
)
829 (symbolp (car thing
))
831 '(scanned scanned-no-recurse
833 . semanticdb-find-adebug-insert-scanned-tag-cons
)
834 data-debug-thing-alist
))
838 (message "There are no includes scanned %s"
841 (data-debug-new-buffer "*SEMANTICDB scanned-includes ADEBUG*")
842 (data-debug-insert-stuff-list scanned
"*")
847 ;; Once you have a search result, use these routines to operate
848 ;; on the search results at a higher level
851 (defun semanticdb-strip-find-results (results &optional find-file-match
)
852 "Strip a semanticdb search RESULTS to exclude objects.
853 This makes it appear more like the results of a `semantic-find-' call.
854 Optional FIND-FILE-MATCH loads all files associated with RESULTS
855 into buffers. This has the side effect of enabling `semantic-tag-buffer' to
857 If FIND-FILE-MATCH is 'name, then only the filename is stored
858 in each tag instead of loading each file into a buffer.
859 If the input RESULTS are not going to be used again, and if
860 FIND-FILE-MATCH is nil, you can use `semanticdb-fast-strip-find-results'
863 ;; Load all files associated with RESULTS.
867 (let ((tab (car (car tmp
)))
868 (tags (cdr (car tmp
))))
870 ;; Normalization gives specialty database tables a chance
871 ;; to convert into a more stable tag format.
872 (let* ((norm (semanticdb-normalize-one-tag tab T
))
877 ;; If it didn't normalize, use what we had.
880 (setq output
(append output
(list ntag
))))
882 ;; Find-file-match allows a tool to make sure the tag is
883 ;; 'live', somewhere in a buffer.
884 (cond ((eq find-file-match
'name
)
885 (or (semantic--tag-get-property ntag
:filename
)
886 (let ((f (semanticdb-full-filename nametable
)))
887 (semantic--tag-put-property ntag
:filename f
))))
888 ((and find-file-match ntab
)
889 (semanticdb-get-buffer ntab
))
893 (setq tmp
(cdr tmp
)))
895 ;; @todo - I could use nconc, but I don't know what the caller may do with
896 ;; RESULTS after this is called. Right now semantic-complete will
897 ;; recycling the input after calling this routine.
898 (apply #'append
(mapcar #'cdr results
))))
900 (defun semanticdb-fast-strip-find-results (results)
901 "Destructively strip a semanticdb search RESULTS to exclude objects.
902 This makes it appear more like the results of a `semantic-find-' call.
903 This is like `semanticdb-strip-find-results', except the input list RESULTS
905 (apply #'nconc
(mapcar #'cdr results
)))
907 (defun semanticdb-find-results-p (resultp)
908 "Non-nil if RESULTP is in the form of a semanticdb search result.
909 This query only really tests the first entry in the list that is RESULTP,
910 but should be good enough for debugging assertions."
912 (listp (car resultp
))
913 (semanticdb-abstract-table-child-p (car (car resultp
)))
914 (or (semantic-tag-p (car (cdr (car resultp
))))
915 (null (car (cdr (car resultp
)))))))
917 (defun semanticdb-find-result-prin1-to-string (result)
918 "Presuming RESULT satisfies `semanticdb-find-results-p', provide a short PRIN1 output."
919 (if (< (length result
) 2)
920 (concat "#<FIND RESULT "
921 (mapconcat (lambda (a)
922 (concat "(" (eieio-object-name (car a
) ) " . "
923 "#<TAG LIST " (number-to-string (length (cdr a
))) ">)"))
927 ;; Longer results should have an abbreviated form.
928 (format "#<FIND RESULT %d TAGS in %d FILES>"
929 (semanticdb-find-result-length result
)
932 (defun semanticdb-find-result-with-nil-p (resultp)
933 "Non-nil of RESULTP is in the form of a semanticdb search result.
934 The value nil is valid where a TABLE usually is, but only if the TAG
935 results include overlays.
936 This query only really tests the first entry in the list that is RESULTP,
937 but should be good enough for debugging assertions."
939 (listp (car resultp
))
940 (let ((tag-to-test (car-safe (cdr (car resultp
)))))
941 (or (and (semanticdb-abstract-table-child-p (car (car resultp
)))
942 (or (semantic-tag-p tag-to-test
)
944 (and (null (car (car resultp
)))
945 (or (semantic-tag-with-position-p tag-to-test
)
946 (null tag-to-test
))))
950 (defun semanticdb-find-result-length (result)
951 "Number of tags found in RESULT."
953 (mapc (lambda (onetable)
954 (setq count
(+ count
(1- (length onetable
)))))
959 (defun semanticdb-find-result-nth (result n
)
960 "In RESULT, return the Nth search result.
961 This is a 0 based search result, with the first match being element 0.
963 The returned value is a cons cell: (TAG . TABLE) where TAG
964 is the tag at the Nth position. TABLE is the semanticdb table where
965 the TAG was found. Sometimes TABLE can be nil."
968 ;; Loop over each single table hit.
969 (while (and (not ans
) result
)
970 ;; For each table result, get local length, and modify
971 ;; N to be that much less.
972 (let ((ll (length (cdr (car result
))))) ;; local length
974 ;; We have a local match.
975 (setq ans
(nth n
(cdr (car result
)))
976 anstable
(car (car result
)))
977 ;; More to go. Decrement N.
980 (setq result
(cdr result
)))
981 (cons ans anstable
)))
983 (defun semanticdb-find-result-test (result)
984 "Test RESULT by accessing all the tags in the list."
985 (if (not (semanticdb-find-results-p result
))
986 (error "Does not pass `semanticdb-find-results-p.\n"))
987 (let ((len (semanticdb-find-result-length result
))
990 (let ((tag (semanticdb-find-result-nth result i
)))
991 (if (not (semantic-tag-p (car tag
)))
992 (error "%d entry is not a tag" i
)))
996 (defun semanticdb-find-result-nth-in-buffer (result n
)
997 "In RESULT, return the Nth search result.
998 Like `semanticdb-find-result-nth', except that only the TAG
999 is returned, and the buffer it is found it will be made current.
1000 If the result tag has no position information, the originating buffer
1001 is still made current."
1002 (let* ((ret (semanticdb-find-result-nth result n
))
1004 (anstable (cdr ret
)))
1005 ;; If we have a hit, double-check the find-file
1006 ;; entry. If the file must be loaded, then gat that table's
1007 ;; source file into a buffer.
1010 (let ((norm (semanticdb-normalize-one-tag anstable ans
)))
1012 ;; The normalized tags can now be found based on that
1016 (semanticdb-set-buffer (car norm
))
1018 (setq ans
(cdr norm
)))
1019 ;; Don't error for this case, but don't store
1020 ;; the thing either.
1021 (no-method-definition nil
))
1027 (defun semanticdb-find-result-mapc (fcn result
)
1028 "Apply FCN to each element of find RESULT for side-effects only.
1029 FCN takes two arguments. The first is a TAG, and the
1030 second is a DB from whence TAG originated.
1032 (mapc (lambda (sublst-icky)
1033 (mapc (lambda (tag-icky)
1034 (funcall fcn tag-icky
(car sublst-icky
)))
1041 ;; Basic logging to see what the search routines are doing.
1042 (defvar semanticdb-find-log-flag nil
1043 "Non-nil means log the process of searches.")
1045 (defvar semanticdb-find-log-buffer-name
"*SemanticDB Find Log*"
1046 "The name of the logging buffer.")
1048 (defun semanticdb-find-toggle-logging ()
1049 "Toggle semanticdb logging."
1051 (setq semanticdb-find-log-flag
(null semanticdb-find-log-flag
))
1052 (message "Semanticdb find logging is %sabled"
1053 (if semanticdb-find-log-flag
"en" "dis")))
1055 (defun semanticdb-reset-log ()
1056 "Reset the log buffer."
1058 (when semanticdb-find-log-flag
1059 (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name
)
1063 (defun semanticdb-find-log-move-to-end ()
1064 "Move to the end of the semantic log."
1065 (let ((cb (current-buffer))
1066 (cw (selected-window)))
1069 (set-buffer semanticdb-find-log-buffer-name
)
1070 (if (get-buffer-window (current-buffer) 'visible
)
1071 (select-window (get-buffer-window (current-buffer) 'visible
)))
1072 (goto-char (point-max)))
1073 (if cw
(select-window cw
))
1076 (defun semanticdb-find-log-new-search (forwhat)
1077 "Start a new search FORWHAT."
1078 (when semanticdb-find-log-flag
1079 (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name
)
1080 (insert (format "New Search: %S\n" forwhat
))
1082 (semanticdb-find-log-move-to-end)))
1084 (defun semanticdb-find-log-activity (table result
)
1085 "Log that TABLE has been searched and RESULT was found."
1086 (when semanticdb-find-log-flag
1087 (with-current-buffer semanticdb-find-log-buffer-name
1088 (insert "Table: " (object-print table
)
1089 " Result: " (int-to-string (length result
)) " tags"
1092 (semanticdb-find-log-move-to-end)))
1094 ;;; Semanticdb find API functions
1095 ;; These are the routines actually used to perform searches.
1097 (defun semanticdb-find-tags-collector (function &optional path find-file-match
1099 "Collect all tags returned by FUNCTION over PATH.
1100 The FUNCTION must take two arguments. The first is TABLE,
1101 which is a semanticdb table containing tags. The second argument
1102 to FUNCTION is TAGS. TAGS may be a list of tags. If TAGS is non-nil,
1103 then FUNCTION should search the TAG list, not through TABLE.
1105 See `semanticdb-find-translate-path' for details on PATH.
1106 FIND-FILE-MATCH indicates that any time a match is found, the file
1107 associated with that tag should be loaded into a buffer.
1109 Note: You should leave FIND-FILE-MATCH as nil. It is far more
1110 efficient to take the results from any search and use
1111 `semanticdb-strip-find-results' instead. This argument is here
1112 for backward compatibility.
1114 If optional argument BRUTISH is non-nil, then ignore include statements,
1115 and search all tables in this project tree."
1118 ;; If path is a buffer, set ourselves up in that buffer
1119 ;; so that the override methods work correctly.
1120 (when (bufferp path
) (set-buffer path
))
1121 (if (semanticdb-find-results-p path
)
1122 ;; When we get find results, loop over that.
1123 (dolist (tableandtags path
)
1124 (semantic-throw-on-input 'semantic-find-translate-path
)
1125 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
1126 ;; `semanticdb-search-results-table', since those are system
1127 ;; databases and not associated with a file.
1128 (unless (and find-file-match
1130 (car tableandtags
) semanticdb-search-results-table
))
1131 (when (setq match
(funcall function
1132 (car tableandtags
) (cdr tableandtags
)))
1133 (when find-file-match
1134 (save-excursion (semanticdb-set-buffer (car tableandtags
))))
1135 (push (cons (car tableandtags
) match
) found
)))
1137 ;; Only log searches across data bases.
1138 (semanticdb-find-log-new-search nil
)
1139 ;; If we get something else, scan the list of tables resulting
1140 ;; from translating it into a list of objects.
1141 (dolist (table (semanticdb-find-translate-path path brutish
))
1142 (semantic-throw-on-input 'semantic-find-translate-path
)
1143 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
1144 ;; `semanticdb-search-results-table', since those are system
1145 ;; databases and not associated with a file.
1146 (unless (and find-file-match
1147 (obj-of-class-p table semanticdb-search-results-table
))
1148 (when (and table
(setq match
(funcall function table nil
)))
1149 (semanticdb-find-log-activity table match
)
1150 (when find-file-match
1151 (save-excursion (semanticdb-set-buffer table
)))
1152 (push (cons table match
) found
))))))
1153 ;; At this point, FOUND has had items pushed onto it.
1154 ;; This means items are being returned in REVERSE order
1155 ;; of the tables searched, so if you just get th CAR, then
1156 ;; too-bad, you may have some system-tag that has no
1157 ;; buffer associated with it.
1159 ;; It must be reversed.
1163 (defun semanticdb-find-tags-by-name (name &optional path find-file-match
)
1164 "Search for all tags matching NAME on PATH.
1165 See `semanticdb-find-translate-path' for details on PATH.
1166 FIND-FILE-MATCH indicates that any time a match is found, the file
1167 associated with that tag should be loaded into a buffer."
1168 (semanticdb-find-tags-collector
1169 (lambda (table tags
)
1170 (semanticdb-find-tags-by-name-method table name tags
))
1171 path find-file-match
))
1174 (defun semanticdb-find-tags-by-name-regexp (regexp &optional path find-file-match
)
1175 "Search for all tags matching REGEXP on PATH.
1176 See `semanticdb-find-translate-path' for details on PATH.
1177 FIND-FILE-MATCH indicates that any time a match is found, the file
1178 associated with that tag should be loaded into a buffer."
1179 (semanticdb-find-tags-collector
1180 (lambda (table tags
)
1181 (semanticdb-find-tags-by-name-regexp-method table regexp tags
))
1182 path find-file-match
))
1185 (defun semanticdb-find-tags-for-completion (prefix &optional path find-file-match
)
1186 "Search for all tags matching PREFIX on PATH.
1187 See `semanticdb-find-translate-path' for details on PATH.
1188 FIND-FILE-MATCH indicates that any time a match is found, the file
1189 associated with that tag should be loaded into a buffer."
1190 (semanticdb-find-tags-collector
1191 (lambda (table tags
)
1192 (semanticdb-find-tags-for-completion-method table prefix tags
))
1193 path find-file-match
))
1196 (defun semanticdb-find-tags-by-class (class &optional path find-file-match
)
1197 "Search for all tags of CLASS on PATH.
1198 See `semanticdb-find-translate-path' for details on PATH.
1199 FIND-FILE-MATCH indicates that any time a match is found, the file
1200 associated with that tag should be loaded into a buffer."
1201 (semanticdb-find-tags-collector
1202 (lambda (table tags
)
1203 (semanticdb-find-tags-by-class-method table class tags
))
1204 path find-file-match
))
1207 (defun semanticdb-deep-find-tags-by-name (name &optional path find-file-match
)
1208 "Search for all tags matching NAME on PATH.
1209 Search also in all components of top level tags founds.
1210 See `semanticdb-find-translate-path' for details on PATH.
1211 FIND-FILE-MATCH indicates that any time a match is found, the file
1212 associated with that tag should be loaded into a buffer."
1213 (semanticdb-find-tags-collector
1214 (lambda (table tags
)
1215 (semanticdb-deep-find-tags-by-name-method table name tags
))
1216 path find-file-match
))
1218 (defun semanticdb-deep-find-tags-by-name-regexp (regexp &optional path find-file-match
)
1219 "Search for all tags matching REGEXP on PATH.
1220 Search also in all components of top level tags founds.
1221 See `semanticdb-find-translate-path' for details on PATH.
1222 FIND-FILE-MATCH indicates that any time a match is found, the file
1223 associated with that tag should be loaded into a buffer."
1224 (semanticdb-find-tags-collector
1225 (lambda (table tags
)
1226 (semanticdb-deep-find-tags-by-name-regexp-method table regexp tags
))
1227 path find-file-match
))
1229 (defun semanticdb-deep-find-tags-for-completion (prefix &optional path find-file-match
)
1230 "Search for all tags matching PREFIX on PATH.
1231 Search also in all components of top level tags founds.
1232 See `semanticdb-find-translate-path' for details on PATH.
1233 FIND-FILE-MATCH indicates that any time a match is found, the file
1234 associated with that tag should be loaded into a buffer."
1235 (semanticdb-find-tags-collector
1236 (lambda (table tags
)
1237 (semanticdb-deep-find-tags-for-completion-method table prefix tags
))
1238 path find-file-match
))
1240 ;;; Brutish Search Routines
1242 (defun semanticdb-brute-deep-find-tags-by-name (name &optional path find-file-match
)
1243 "Search for all tags matching NAME on PATH.
1244 See `semanticdb-find-translate-path' for details on PATH.
1245 The argument BRUTISH will be set so that searching includes all tables
1246 in the current project.
1247 FIND-FILE-MATCH indicates that any time a match is found, the file
1248 associated wit that tag should be loaded into a buffer."
1249 (semanticdb-find-tags-collector
1250 (lambda (table tags
)
1251 (semanticdb-deep-find-tags-by-name-method table name tags
))
1252 path find-file-match t
))
1254 (defun semanticdb-brute-deep-find-tags-for-completion (prefix &optional path find-file-match
)
1255 "Search for all tags matching PREFIX on PATH.
1256 See `semanticdb-find-translate-path' for details on PATH.
1257 The argument BRUTISH will be set so that searching includes all tables
1258 in the current project.
1259 FIND-FILE-MATCH indicates that any time a match is found, the file
1260 associated wit that tag should be loaded into a buffer."
1261 (semanticdb-find-tags-collector
1262 (lambda (table tags
)
1263 (semanticdb-deep-find-tags-for-completion-method table prefix tags
))
1264 path find-file-match t
))
1266 (defun semanticdb-brute-find-tags-by-class (class &optional path find-file-match
)
1267 "Search for all tags of CLASS on PATH.
1268 See `semanticdb-find-translate-path' for details on PATH.
1269 The argument BRUTISH will be set so that searching includes all tables
1270 in the current project.
1271 FIND-FILE-MATCH indicates that any time a match is found, the file
1272 associated with that tag should be loaded into a buffer."
1273 (semanticdb-find-tags-collector
1274 (lambda (table tags
)
1275 (semanticdb-find-tags-by-class-method table class tags
))
1276 path find-file-match t
))
1278 ;;; Specialty Search Routines
1279 (defun semanticdb-find-tags-external-children-of-type
1280 (type &optional path find-file-match
)
1281 "Search for all tags defined outside of TYPE w/ TYPE as a parent.
1282 See `semanticdb-find-translate-path' for details on PATH.
1283 FIND-FILE-MATCH indicates that any time a match is found, the file
1284 associated with that tag should be loaded into a buffer."
1285 (semanticdb-find-tags-collector
1286 (lambda (table tags
)
1287 (semanticdb-find-tags-external-children-of-type-method table type tags
))
1288 path find-file-match t
))
1290 (defun semanticdb-find-tags-subclasses-of-type
1291 (type &optional path find-file-match
)
1292 "Search for all tags of class type defined that subclass TYPE.
1293 See `semanticdb-find-translate-path' for details on PATH.
1294 FIND-FILE-MATCH indicates that any time a match is found, the file
1295 associated with that tag should be loaded into a buffer."
1296 (semanticdb-find-tags-collector
1297 (lambda (table tags
)
1298 (semanticdb-find-tags-subclasses-of-type-method table type tags
))
1299 path find-file-match t
))
1303 ;; Default methods for semanticdb database and table objects.
1304 ;; Override these with system databases to as new types of back ends.
1306 ;;; Top level Searches
1307 (defmethod semanticdb-find-tags-by-name-method ((table semanticdb-abstract-table
) name
&optional tags
)
1308 "In TABLE, find all occurrences of tags with NAME.
1309 Optional argument TAGS is a list of tags to search.
1310 Returns a table of all matching tags."
1311 (semantic-find-tags-by-name name
(or tags
(semanticdb-get-tags table
))))
1313 (defmethod semanticdb-find-tags-by-name-regexp-method ((table semanticdb-abstract-table
) regexp
&optional tags
)
1314 "In TABLE, find all occurrences of tags matching REGEXP.
1315 Optional argument TAGS is a list of tags to search.
1316 Returns a table of all matching tags."
1317 (semantic-find-tags-by-name-regexp regexp
(or tags
(semanticdb-get-tags table
))))
1319 (defmethod semanticdb-find-tags-for-completion-method ((table semanticdb-abstract-table
) prefix
&optional tags
)
1320 "In TABLE, find all occurrences of tags matching PREFIX.
1321 Optional argument TAGS is a list of tags to search.
1322 Returns a table of all matching tags."
1323 (semantic-find-tags-for-completion prefix
(or tags
(semanticdb-get-tags table
))))
1325 (defmethod semanticdb-find-tags-by-class-method ((table semanticdb-abstract-table
) class
&optional tags
)
1326 "In TABLE, find all occurrences of tags of CLASS.
1327 Optional argument TAGS is a list of tags to search.
1328 Returns a table of all matching tags."
1329 ;; Delegate 'include' to the overridable
1330 ;; `semantic-find-tags-included', which by default will just call
1331 ;; `semantic-find-tags-by-class'.
1332 (if (eq class
'include
)
1333 (semantic-find-tags-included (or tags
(semanticdb-get-tags table
)))
1334 (semantic-find-tags-by-class class
(or tags
(semanticdb-get-tags table
)))))
1336 (defmethod semanticdb-find-tags-external-children-of-type-method ((table semanticdb-abstract-table
) parent
&optional tags
)
1337 "In TABLE, find all occurrences of tags whose parent is the PARENT type.
1338 Optional argument TAGS is a list of tags to search.
1339 Returns a table of all matching tags."
1340 (require 'semantic
/find
)
1341 (semantic-find-tags-external-children-of-type parent
(or tags
(semanticdb-get-tags table
))))
1343 (defmethod semanticdb-find-tags-subclasses-of-type-method ((table semanticdb-abstract-table
) parent
&optional tags
)
1344 "In TABLE, find all occurrences of tags whose parent is the PARENT type.
1345 Optional argument TAGS is a list of tags to search.
1346 Returns a table of all matching tags."
1347 (require 'semantic
/find
)
1348 (semantic-find-tags-subclasses-of-type parent
(or tags
(semanticdb-get-tags table
))))
1351 (defmethod semanticdb-deep-find-tags-by-name-method ((table semanticdb-abstract-table
) name
&optional tags
)
1352 "In TABLE, find all occurrences of tags with NAME.
1353 Search in all tags in TABLE, and all components of top level tags in
1355 Optional argument TAGS is a list of tags to search.
1356 Return a table of all matching tags."
1357 (semantic-find-tags-by-name name
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1359 (defmethod semanticdb-deep-find-tags-by-name-regexp-method ((table semanticdb-abstract-table
) regexp
&optional tags
)
1360 "In TABLE, find all occurrences of tags matching REGEXP.
1361 Search in all tags in TABLE, and all components of top level tags in
1363 Optional argument TAGS is a list of tags to search.
1364 Return a table of all matching tags."
1365 (semantic-find-tags-by-name-regexp regexp
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1367 (defmethod semanticdb-deep-find-tags-for-completion-method ((table semanticdb-abstract-table
) prefix
&optional tags
)
1368 "In TABLE, find all occurrences of tags matching PREFIX.
1369 Search in all tags in TABLE, and all components of top level tags in
1371 Optional argument TAGS is a list of tags to search.
1372 Return a table of all matching tags."
1373 (semantic-find-tags-for-completion prefix
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1375 (provide 'semantic
/db-find
)
1378 ;; generated-autoload-file: "loaddefs.el"
1379 ;; generated-autoload-load-name: "semantic/db-find"
1382 ;;; semantic/db-find.el ends here