Mercurial > emacs
annotate lisp/cedet/semantic/find.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 | b22b44e953cb |
children | df08b7ab0ba0 |
rev | line source |
---|---|
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
1 ;;; semantic/find.el --- Search routines for Semantic |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: syntax |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Routines for searching through lists of tags. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; There are several groups of tag search routines: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; 1) semantic-brute-find-tag-by-* |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; These routines use brute force hierarchical search to scan |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; through lists of tags. They include some parameters |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; used for compatibility with the semantic 1.x search routines. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; 1.5) semantic-brute-find-first-tag-by-* |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; Like 1, except seraching stops on the first match for the given |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; information. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; 2) semantic-find-tag-by-* |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; These prefered search routines attempt to scan through lists |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; in an intelligent way based on questions asked. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;; 3) semantic-find-*-overlay |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;; These routines use overlays to return tags based on a buffer position. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; 4) ... |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
47 (require 'semantic) |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (require 'semantic/tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;;; Code: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;;; Overlay Search Routines |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;; These routines provide fast access to tokens based on a buffer that |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 ;; has parsed tokens in it. Uses overlays to perform the hard work. |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
56 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
57 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (defun semantic-find-tag-by-overlay (&optional positionormarker buffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 "Find all tags covering POSITIONORMARKER by using overlays. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 If POSITIONORMARKER is nil, use the current point. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 Optional BUFFER is used if POSITIONORMARKER is a number, otherwise the current |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 buffer is used. This finds all tags covering the specified position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 by checking for all overlays covering the current spot. They are then sorted |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 from largest to smallest via the start location." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (when positionormarker |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (if (markerp positionormarker) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 (set-buffer (marker-buffer positionormarker)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (if (bufferp buffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (set-buffer buffer)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (let ((ol (semantic-overlays-at (or positionormarker (point)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (ret nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (while ol |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (let ((tmp (semantic-overlay-get (car ol) 'semantic))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (when (and tmp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 ;; We don't need with-position because no tag w/out |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 ;; a position could exist in an overlay. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (semantic-tag-p tmp)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (setq ret (cons tmp ret)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (setq ol (cdr ol))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (sort ret (lambda (a b) (< (semantic-tag-start a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (semantic-tag-start b))))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
84 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (defun semantic-find-tag-by-overlay-in-region (start end &optional buffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 "Find all tags which exist in whole or in part between START and END. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 Uses overlays to determine positin. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 Optional BUFFER argument specifies the buffer to use." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (if buffer (set-buffer buffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (let ((ol (semantic-overlays-in start end)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (ret nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (while ol |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (let ((tmp (semantic-overlay-get (car ol) 'semantic))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (when (and tmp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ;; See above about position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (semantic-tag-p tmp)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (setq ret (cons tmp ret)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (setq ol (cdr ol))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (sort ret (lambda (a b) (< (semantic-tag-start a) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (semantic-tag-start b))))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
103 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (defun semantic-find-tag-by-overlay-next (&optional start buffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 "Find the next tag after START in BUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 If START is in an overlay, find the tag which starts next, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 not the current tag." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (if buffer (set-buffer buffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (if (not start) (setq start (point))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (let ((os start) (ol nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (while (and os (< os (point-max)) (not ol)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (setq os (semantic-overlay-next-change os)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (when os |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 ;; Get overlays at position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (setq ol (semantic-overlays-at os)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 ;; find the overlay that belongs to semantic |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 ;; and starts at the found position. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (while (and ol (listp ol)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (if (and (semantic-overlay-get (car ol) 'semantic) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (semantic-tag-p |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (semantic-overlay-get (car ol) 'semantic)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (= (semantic-overlay-start (car ol)) os)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (setq ol (car ol))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (when (listp ol) (setq ol (cdr ol)))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 ;; convert ol to a tag |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (when (and ol (semantic-tag-p (semantic-overlay-get ol 'semantic))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (semantic-overlay-get ol 'semantic))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
130 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (defun semantic-find-tag-by-overlay-prev (&optional start buffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 "Find the next tag before START in BUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 If START is in an overlay, find the tag which starts next, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 not the current tag." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (if buffer (set-buffer buffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (if (not start) (setq start (point))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (let ((os start) (ol nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (while (and os (> os (point-min)) (not ol)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (setq os (semantic-overlay-previous-change os)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (when os |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 ;; Get overlays at position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (setq ol (semantic-overlays-at (1- os))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;; find the overlay that belongs to semantic |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ;; and ENDS at the found position. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 ;; Use end because we are going backward. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (while (and ol (listp ol)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (if (and (semantic-overlay-get (car ol) 'semantic) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (semantic-tag-p |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (semantic-overlay-get (car ol) 'semantic)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (= (semantic-overlay-end (car ol)) os)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (setq ol (car ol))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (when (listp ol) (setq ol (cdr ol)))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ;; convert ol to a tag |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (when (and ol |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (semantic-tag-p (semantic-overlay-get ol 'semantic))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (semantic-overlay-get ol 'semantic))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
160 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (defun semantic-find-tag-parent-by-overlay (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 "Find the parent of TAG by overlays. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 Overlays are a fast way of finding this information for active buffers." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (let ((tag (nreverse (semantic-find-tag-by-overlay |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (semantic-tag-start tag))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 ;; This is a lot like `semantic-current-tag-parent', but |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ;; it uses a position to do it's work. Assumes two tags don't share |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 ;; the same start unless they are siblings. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (car (cdr tag)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
171 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (defun semantic-current-tag () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 "Return the current tag in the current buffer. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 If there are more than one in the same location, return the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 smallest tag. Return nil if there is no tag here." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (car (nreverse (semantic-find-tag-by-overlay)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (defun semantic-current-tag-parent () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 "Return the current tags parent in the current buffer. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 A tag's parent would be a containing structure, such as a type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 containing a field. Return nil if there is no parent." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (car (cdr (nreverse (semantic-find-tag-by-overlay))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (defun semantic-current-tag-of-class (class) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 "Return the current (smallest) tags of CLASS in the current buffer. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 If the smallest tag is not of type CLASS, keep going upwards until one |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 is found. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 Uses `semantic-tag-class' for classification." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (let ((tags (nreverse (semantic-find-tag-by-overlay)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (while (and tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (not (eq (semantic-tag-class (car tags)) class))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 ;;; Search Routines |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ;; These are routines that search a single tags table. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 ;; The original API (see COMPATIBILITY section below) in semantic 1.4 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 ;; had these usage statistics: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 ;; semantic-find-nonterminal-by-name 17 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 ;; semantic-find-nonterminal-by-name-regexp 8 - Most doing completion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 ;; semantic-find-nonterminal-by-position 13 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 ;; semantic-find-nonterminal-by-token 21 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 ;; semantic-find-nonterminal-by-type 2 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 ;; semantic-find-nonterminal-standard 1 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 ;; semantic-find-nonterminal-by-function (not in other searches) 1 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 ;; New API: As above w/out `search-parts' or `search-includes' arguments. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 ;; Extra fcn: Specific to completion which is what -name-regexp is |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 ;; mostly used for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 ;; As for the sarguments "search-parts" and "search-includes" here |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ;; are stats: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 ;; search-parts: 4 - charting x2, find-doc, senator (sans db) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 ;; Implement command to flatten a tag table. Call new API Fcn w/ |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ;; flattened table for same results. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; search-include: 2 - analyze x2 (sans db) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 ;; Not used effectively. Not to be re-implemented here. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (defsubst semantic--find-tags-by-function (predicate &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 "Find tags for which PREDICATE is non-nil in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 PREDICATE is a lambda expression which accepts on TAG. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 TABLE is a semantic tags table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (let ((tags (semantic-something-to-tag-table table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (result nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 ; (mapc (lambda (tag) (and (funcall predicate tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 ; (setq result (cons tag result)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 ; tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ;; A while loop is actually faster. Who knew |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (and (funcall predicate (car tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (setq result (cons (car tags) result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (nreverse result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 ;; I can shave off some time by removing the funcall (see above) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 ;; and having the question be inlined in the while loop. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 ;; Strangely turning the upper level fcns into macros had a larger |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 ;; impact. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (defmacro semantic--find-tags-by-macro (form &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 "Find tags for which FORM is non-nil in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 TABLE is a semantic tags table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 `(let ((tags (semantic-something-to-tag-table ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (result nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (and ,form |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (setq result (cons (car tags) result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (nreverse result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 ;;; Top level Searches |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
259 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
260 ;;;###autoload |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
261 (defun semantic-find-first-tag-by-name (name &optional table) |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 "Find the first tag with NAME in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 TABLE is a semantic tags table. See `semantic-something-to-tag-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 This routine uses `assoc' to quickly find the first matching entry." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (funcall (if semantic-case-fold 'assoc-ignore-case 'assoc) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 name (semantic-something-to-tag-table table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 (defmacro semantic-find-tags-by-name (name &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 "Find all tags with NAME in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 `(let ((case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (string= ,name (semantic-tag-name (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (defmacro semantic-find-tags-for-completion (prefix &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 "Find all tags whos name begins with PREFIX in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 PREFIX is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 TABLE is a tag table. See `semantic-something-to-tag-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 While it would be nice to use `try-completion' or `all-completions', |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 those functions do not return the tags, only a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 Uses `compare-strings' for fast comparison." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 `(let ((l (length ,prefix))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (eq (compare-strings ,prefix 0 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (semantic-tag-name (car tags)) 0 l |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 semantic-case-fold) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 t) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (defmacro semantic-find-tags-by-name-regexp (regexp &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 "Find all tags with name matching REGEXP in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 REGEXP is a string containing a regular expression, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 TABLE is a tag table. See `semantic-something-to-tag-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 Consider using `semantic-find-tags-for-completion' if you are |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 attempting to do completions." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 `(let ((case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (string-match ,regexp (semantic-tag-name (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (defmacro semantic-find-tags-by-class (class &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 "Find all tags of class CLASS in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 CLASS is a symbol representing the class of the token, such as |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 'variable, of 'function.. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (eq ,class (semantic-tag-class (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (defmacro semantic-find-tags-by-type (type &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 "Find all tags of with a type TYPE in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 TYPE is a string or tag representing a data type as defined in the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 language the tags were parsed from, such as \"int\", or perhaps |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 a tag whose name is that of a struct or class. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (semantic-tag-of-type-p (car tags) ,type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (defmacro semantic-find-tags-of-compound-type (&optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 "Find all tags which are a compound type in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 Compound types are structures, or other data type which |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 is not of a primitive nature, such as int or double. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 Used in completion." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (semantic-tag-type-compound-p (car tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (define-overloadable-function semantic-find-tags-by-scope-protection (scopeprotection parent &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 "Find all tags accessable by SCOPEPROTECTION. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 SCOPEPROTECTION is a symbol which can be returned by the method |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 `semantic-tag-protection'. A hard-coded order is used to determine a match. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 PARENT is a tag representing the PARENT slot needed for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 `semantic-tag-protection'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 TABLE is a list of tags (a subset of PARENT members) to scan. If TABLE is nil, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 the type members of PARENT are used. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 See `semantic-tag-protected-p' for details on which tags are returned." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (if (not (eq (semantic-tag-class parent) 'type)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 (signal 'wrong-type-argument '(semantic-find-tags-by-scope-protection |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 parent |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 semantic-tag-class type)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (:override))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
347 (declare-function semantic-tag-protected-p "semantic/tag-ls") |
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
348 |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (defun semantic-find-tags-by-scope-protection-default |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (scopeprotection parent &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 "Find all tags accessable by SCOPEPROTECTION. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 SCOPEPROTECTION is a symbol which can be returned by the method |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 `semantic-tag-protection'. A hard-coded order is used to determine a match. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 PARENT is a tag representing the PARENT slot needed for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 `semantic-tag-protection'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 TABLE is a list of tags (a subset of PARENT members) to scan. If TABLE is nil, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 the type members of PARENT are used. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 See `semantic-tag-protected-p' for details on which tags are returned." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (if (not table) (setq table (semantic-tag-type-members parent))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (if (null scopeprotection) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 table |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
362 (require 'semantic/tag-ls) |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (not (semantic-tag-protected-p (car tags) scopeprotection parent)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (defsubst semantic-find-tags-included (&optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 "Find all tags in TABLE that are of the 'include class. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (semantic-find-tags-by-class 'include table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 ;;; Deep Searches |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (defmacro semantic-deep-find-tags-by-name (name &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 "Find all tags with NAME in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 Search in top level tags, and their components, in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 TABLE is a tag table. See `semantic-flatten-tags-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 See also `semantic-find-tags-by-name'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 `(semantic-find-tags-by-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 ,name (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (defmacro semantic-deep-find-tags-for-completion (prefix &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 "Find all tags whos name begins with PREFIX in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 Search in top level tags, and their components, in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 TABLE is a tag table. See `semantic-flatten-tags-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 See also `semantic-find-tags-for-completion'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 `(semantic-find-tags-for-completion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 ,prefix (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (defmacro semantic-deep-find-tags-by-name-regexp (regexp &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 "Find all tags with name matching REGEXP in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 Search in top level tags, and their components, in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 REGEXP is a string containing a regular expression, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 TABLE is a tag table. See `semantic-flatten-tags-table'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 See also `semantic-find-tags-by-name-regexp'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 Consider using `semantic-deep-find-tags-for-completion' if you are |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 attempting to do completions." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 `(semantic-find-tags-by-name-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 ,regexp (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 ;;; Specialty Searches |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 ;; |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
404 (declare-function semantic-tag-external-member-parent "semantic/sort") |
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
405 |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (defun semantic-find-tags-external-children-of-type (type &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 "Find all tags in whose parent is TYPE in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 These tags are defined outside the scope of the original TYPE declaration. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 (equal (semantic-tag-external-member-parent (car tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (defun semantic-find-tags-subclasses-of-type (type &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 "Find all tags of class type in whose parent is TYPE in TABLE. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 These tags are defined outside the scope of the original TYPE declaration. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 TABLE is a tag table. See `semantic-something-to-tag-table'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (and (eq (semantic-tag-class (car tags)) 'type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (or (member type (semantic-tag-type-superclasses (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (member type (semantic-tag-type-interfaces (car tags))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 ;; ************************** Compatibility *************************** |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 ;;; Old Style Brute Force Search Routines |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 ;; These functions will search through tags lists explicity for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;; desired information. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 ;; The -by-name nonterminal search can use the built in fcn |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 ;; `assoc', which is faster than looping ourselves, so we will |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;; not use `semantic-brute-find-tag-by-function' to do this, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 ;; instead erroring on the side of speed. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (defun semantic-brute-find-first-tag-by-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (name streamorbuffer &optional search-parts search-include) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 "Find a tag NAME within STREAMORBUFFER. NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 If SEARCH-PARTS is non-nil, search children of tags. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 If SEARCH-INCLUDE was never implemented. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 Use `semantic-find-first-tag-by-name' instead." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 (let* ((stream (semantic-something-to-tag-table streamorbuffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 (assoc-fun (if semantic-case-fold |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 #'assoc-ignore-case |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 #'assoc)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (m (funcall assoc-fun name stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (if m |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 m |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (let ((toklst stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 (children nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (while (and (not m) toklst) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (if search-parts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (progn |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (setq children (semantic-tag-components-with-overlays |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (car toklst))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (if children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (setq m (semantic-brute-find-first-tag-by-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 name children search-parts search-include))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (setq toklst (cdr toklst))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (if (not m) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 ;; Go to dependencies, and search there. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 m)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (defmacro semantic-brute-find-tag-by-class |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (class streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 "Find all tags with a class CLASS within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 CLASS is a symbol representing the class of the tags to find. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 See `semantic-tag-class'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 `semantic-brute-find-tag-by-function'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 Use `semantic-find-tag-by-class' instead." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 `(semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (lambda (tag) (eq ,class (semantic-tag-class tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 ,streamorbuffer ,search-parts ,search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (defmacro semantic-brute-find-tag-standard |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 (streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 "Find all tags in STREAMORBUFFER which define simple class types. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 See `semantic-tag-class'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 `(semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (lambda (tag) (member (semantic-tag-class tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 '(function variable type))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ,streamorbuffer ,search-parts ,search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (defun semantic-brute-find-tag-by-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (type streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 "Find all tags with type TYPE within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 TYPE is a string which is the name of the type of the tags returned. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 See `semantic-tag-type'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 (lambda (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (let ((ts (semantic-tag-type tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (if (and (listp ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (or (= (length ts) 1) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (eq (semantic-tag-class ts) 'type))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (setq ts (semantic-tag-name ts))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (equal type ts))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 streamorbuffer search-parts search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (defun semantic-brute-find-tag-by-type-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 (regexp streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 "Find all tags with type matching REGEXP within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 REGEXP is a regular expression which matches the name of the type of the |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 tags returned. See `semantic-tag-type'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 (lambda (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (let ((ts (semantic-tag-type tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (if (listp ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 (setq ts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (if (eq (semantic-tag-class ts) 'type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (semantic-tag-name ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (car ts)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (and ts (string-match regexp ts)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 streamorbuffer search-parts search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 (defun semantic-brute-find-tag-by-name-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 (regex streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 "Find all tags whose name match REGEX in STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (lambda (tag) (string-match regex (semantic-tag-name tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (defun semantic-brute-find-tag-by-property |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (property value streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 "Find all tags with PROPERTY equal to VALUE in STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 (lambda (tag) (equal (semantic--tag-get-property tag property) value)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 (defun semantic-brute-find-tag-by-attribute |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 (attr streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 "Find all tags with a given ATTR in STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 ATTR is a symbol key into the attributes list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 (lambda (tag) (semantic-tag-get-attribute tag attr)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 (defun semantic-brute-find-tag-by-attribute-value |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (attr value streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 "Find all tags with a given ATTR equal to VALUE in STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 ATTR is a symbol key into the attributes list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 VALUE is the value that ATTR should match. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (lambda (tag) (equal (semantic-tag-get-attribute tag attr) value)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 (defun semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 (function streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 "Find all tags for which FUNCTION's value is non-nil within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 FUNCTION must return non-nil if an element of STREAM will be included |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 in the new list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 If optional argument SEARCH-PARTS is non-nil, all sub-parts of tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 are searched. The overloadable function `semantic-tag-componenets' is |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 used for the searching child lists. If SEARCH-PARTS is the symbol |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 'positiononly, then only children that have positional information are |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 searched. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 If SEARCH-INCLUDES has not been implemented. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 This parameter hasn't be active for a while and is obsolete." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (let ((stream (semantic-something-to-tag-table streamorbuffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 (sl nil) ;list of tag children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (nl nil) ;new list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (dolist (tag stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 (if (not (semantic-tag-p tag)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 ;; `semantic-tag-components-with-overlays' can return invalid |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 ;; tags if search-parts is not equal to 'positiononly |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 nil ;; Ignore them! |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 (if (funcall function tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (setq nl (cons tag nl))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (and search-parts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (setq sl (if (eq search-parts 'positiononly) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (semantic-tag-components-with-overlays tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (semantic-tag-components tag)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (setq nl (nconc nl |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 function sl |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 search-parts)))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 (setq nl (nreverse nl)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 nl)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (defun semantic-brute-find-first-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 (function streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 "Find the first tag which FUNCTION match within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 FUNCTION must return non-nil if an element of STREAM will be included |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 in the new list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 The following parameters were never implemented. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 If optional argument SEARCH-PARTS, all sub-parts of tags are searched. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 The overloadable function `semantic-tag-components' is used for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 searching. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 If SEARCH-INCLUDES is non-nil, then all include files are also |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 searched for matches." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 (let ((stream (semantic-something-to-tag-table streamorbuffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 (found nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 (while (and (not found) stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 (if (funcall function (car stream)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 (setq found (car stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 (setq stream (cdr stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 found)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 ;;; Old Positional Searches |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 ;; Are these useful anymore? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (defun semantic-brute-find-tag-by-position (position streamorbuffer |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 &optional nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 "Find a tag covering POSITION within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 POSITION is a number, or marker. If NOMEDIAN is non-nil, don't do |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 the median calculation, and return nil." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 (if (markerp position) (set-buffer (marker-buffer position))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (let* ((stream (if (bufferp streamorbuffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 (set-buffer streamorbuffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 (semantic-fetch-tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 streamorbuffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 (prev nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 (found nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 (while (and stream (not found)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 ;; perfect fit |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 (if (and (>= position (semantic-tag-start (car stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 (<= position (semantic-tag-end (car stream)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 (setq found (car stream)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 ;; Median between to objects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 (if (and prev (not nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 (>= position (semantic-tag-end prev)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 (<= position (semantic-tag-start (car stream)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (let ((median (/ (+ (semantic-tag-end prev) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 (semantic-tag-start (car stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 2))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 (setq found |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 (if (> position median) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 (car stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 prev))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 ;; Next!!! |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 (setq prev (car stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 stream (cdr stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 found))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 (defun semantic-brute-find-innermost-tag-by-position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 (position streamorbuffer &optional nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 "Find a list of tags covering POSITION within STREAMORBUFFER. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 POSITION is a number, or marker. If NOMEDIAN is non-nil, don't do |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 the median calculation, and return nil. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 This function will find the topmost item, and recurse until no more |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 details are available of findable." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 (let* ((returnme nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 (current (semantic-brute-find-tag-by-position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 position streamorbuffer nomedian)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 (nextstream (and current |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 (if (eq (semantic-tag-class current) 'type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (semantic-tag-type-members current) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 (while nextstream |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (setq returnme (cons current returnme)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (setq current (semantic-brute-find-tag-by-position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 position nextstream nomedian)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (setq nextstream (and current |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 ;; NOTE TO SELF: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 ;; Looking at this after several years away, |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 ;; what does this do??? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 (if (eq (semantic-tag-class current) 'token) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 (semantic-tag-type-members current) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 (nreverse (cons current returnme)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 ;;; Compatibility Aliases |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 (semantic-alias-obsolete 'semantic-find-nonterminal-by-overlay |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 'semantic-find-tag-by-overlay) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 (semantic-alias-obsolete 'semantic-find-nonterminal-by-overlay-in-region |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 'semantic-find-tag-by-overlay-in-region) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 (semantic-alias-obsolete 'semantic-find-nonterminal-by-overlay-next |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 'semantic-find-tag-by-overlay-next) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 (semantic-alias-obsolete 'semantic-find-nonterminal-by-overlay-prev |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 'semantic-find-tag-by-overlay-prev) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 (semantic-alias-obsolete 'semantic-find-nonterminal-parent-by-overlay |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 'semantic-find-tag-parent-by-overlay) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 (semantic-alias-obsolete 'semantic-current-nonterminal |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 'semantic-current-tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 (semantic-alias-obsolete 'semantic-current-nonterminal-parent |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 'semantic-current-tag-parent) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 (semantic-alias-obsolete 'semantic-current-nonterminal-of-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 'semantic-current-tag-of-class) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 (semantic-alias-obsolete 'semantic-find-nonterminal-by-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 'semantic-brute-find-first-tag-by-name) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 (semantic-alias-obsolete 'semantic-find-nonterminal-by-token |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
726 'semantic-brute-find-tag-by-class) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 (semantic-alias-obsolete 'semantic-find-nonterminal-standard |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 'semantic-brute-find-tag-standard) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 (semantic-alias-obsolete 'semantic-find-nonterminal-by-type |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 'semantic-brute-find-tag-by-type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 (semantic-alias-obsolete 'semantic-find-nonterminal-by-type-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 'semantic-brute-find-tag-by-type-regexp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 (semantic-alias-obsolete 'semantic-find-nonterminal-by-name-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 'semantic-brute-find-tag-by-name-regexp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 (semantic-alias-obsolete 'semantic-find-nonterminal-by-property |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 'semantic-brute-find-tag-by-property) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 (semantic-alias-obsolete 'semantic-find-nonterminal-by-extra-spec |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 'semantic-brute-find-tag-by-attribute) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 (semantic-alias-obsolete 'semantic-find-nonterminal-by-extra-spec-value |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 'semantic-brute-find-tag-by-attribute-value) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 (semantic-alias-obsolete 'semantic-find-nonterminal-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 'semantic-brute-find-tag-by-function) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 (semantic-alias-obsolete 'semantic-find-nonterminal-by-function-first-match |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 'semantic-brute-find-first-tag-by-function) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 (semantic-alias-obsolete 'semantic-find-nonterminal-by-position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 'semantic-brute-find-tag-by-position) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 (semantic-alias-obsolete 'semantic-find-innermost-nonterminal-by-position |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 'semantic-brute-find-innermost-tag-by-position) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 ;;; TESTING |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 (defun semantic-find-benchmark () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 "Run some simple benchmarks to see how we are doing. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 Optional argument ARG is the number of iterations to run." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 (interactive) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 (require 'benchmark) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 (let ((f-name nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 (b-name nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 (f-comp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 (b-comp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 (f-regex) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 (setq f-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 1000 (semantic-find-first-tag-by-name "class3" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 (setq b-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 1000 (semantic-brute-find-first-tag-by-name "class3" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 (setq f-comp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 1000 (semantic-find-tags-for-completion "method" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 (setq b-comp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 1000 (semantic-brute-find-tag-by-name-regexp "^method" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 (setq f-regex |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 1000 (semantic-find-tags-by-name-regexp "^method" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 (message "Name [new old] [ %.3f %.3f ] Complete [newc/new old] [ %.3f/%.3f %.3f ]" |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 (car f-name) (car b-name) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (car f-comp) (car f-regex) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (car b-comp)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (provide 'semantic/find) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
808 ;; Local variables: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
809 ;; generated-autoload-file: "loaddefs.el" |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
810 ;; generated-autoload-feature: semantic/loaddefs |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
811 ;; End: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
812 |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
813 ;;; semantic/find.el ends here |