Mercurial > emacs
annotate lisp/cedet/semantic/find.el @ 104475:9787b67f48d7
Require semantic/db-file.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 07 Sep 2009 16:33:20 +0000 |
parents | 273e528a9f9b |
children | 25e047f7f6a2 |
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 |
104446
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
178 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (defun semantic-current-tag-parent () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 "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
|
181 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
|
182 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
|
183 (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
|
184 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 (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
|
186 "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
|
187 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
|
188 is found. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 Uses `semantic-tag-class' for classification." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (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
|
191 (while (and tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (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
|
193 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (car tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;;; Search Routines |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ;; 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
|
199 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 ;; 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
|
201 ;; had these usage statistics: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 ;; semantic-find-nonterminal-by-name 17 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 ;; 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
|
205 ;; semantic-find-nonterminal-by-position 13 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 ;; semantic-find-nonterminal-by-token 21 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 ;; semantic-find-nonterminal-by-type 2 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 ;; semantic-find-nonterminal-standard 1 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 ;; 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
|
211 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 ;; 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
|
213 ;; 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
|
214 ;; mostly used for |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ;; 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
|
217 ;; are stats: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 ;; 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
|
220 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ;; 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
|
222 ;; flattened table for same results. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 ;; 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
|
225 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 ;; 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
|
227 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (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
|
229 "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
|
230 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
|
231 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
|
232 (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
|
233 (result nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 ; (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
|
235 ; (setq result (cons tag result)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 ; tags) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; 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
|
238 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (and (funcall predicate (car tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (setq result (cons (car tags) result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (nreverse result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 ;; 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
|
245 ;; 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
|
246 ;; 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
|
247 ;; impact. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (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
|
249 "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
|
250 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
|
251 `(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
|
252 (result nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (while tags |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (and ,form |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (setq result (cons (car tags) result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (setq tags (cdr tags))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (nreverse result))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 ;;; Top level Searches |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
260 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
261 ;;;###autoload |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
262 (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
|
263 "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
|
264 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 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
|
266 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
|
267 (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
|
268 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
|
269 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (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
|
271 "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
|
272 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 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
|
274 `(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
|
275 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (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
|
277 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (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
|
280 "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
|
281 PREFIX is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 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
|
283 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
|
284 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
|
285 Uses `compare-strings' for fast comparison." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 `(let ((l (length ,prefix))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (eq (compare-strings ,prefix 0 nil |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (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
|
290 semantic-case-fold) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 t) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (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
|
295 "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
|
296 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
|
297 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
|
298 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
|
299 attempting to do completions." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 `(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
|
301 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (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
|
303 ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (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
|
306 "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
|
307 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
|
308 'variable, of 'function.. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 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
|
310 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (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
|
312 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (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
|
315 "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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (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
|
322 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (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
|
325 "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
|
326 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
|
327 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
|
328 Used in completion." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 `(semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (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
|
331 ,table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 |
104446
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104444
diff
changeset
|
333 ;;;###autoload |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (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
|
335 "Find all tags accessable by SCOPEPROTECTION. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 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
|
337 `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
|
338 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
|
339 `semantic-tag-protection'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 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
|
341 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
|
342 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
|
343 (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
|
344 (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
|
345 parent |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 semantic-tag-class type)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (:override))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
349 (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
|
350 |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (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
|
352 (scopeprotection parent &optional table) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 "Find all tags accessable by SCOPEPROTECTION. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 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
|
355 `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
|
356 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
|
357 `semantic-tag-protection'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 (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
|
362 (if (null scopeprotection) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 table |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
364 (require 'semantic/tag-ls) |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (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
|
367 table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (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
|
370 "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
|
371 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
|
372 (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
|
373 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 ;;; Deep Searches |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (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
|
377 "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
|
378 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
|
379 NAME is a string. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 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
|
381 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
|
382 `(semantic-find-tags-by-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 ,name (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (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
|
386 "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
|
387 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
|
388 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
|
389 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
|
390 `(semantic-find-tags-for-completion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 ,prefix (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (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
|
394 "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
|
395 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
|
396 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
|
397 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
|
398 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
|
399 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
|
400 attempting to do completions." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 `(semantic-find-tags-by-name-regexp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 ,regexp (semantic-flatten-tags-table ,table))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 ;;; Specialty Searches |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 ;; |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
406 (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
|
407 |
104417
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (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
|
409 "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
|
410 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
|
411 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
|
412 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (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
|
414 type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (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
|
418 "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
|
419 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
|
420 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
|
421 (semantic--find-tags-by-macro |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (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
|
423 (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
|
424 (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
|
425 table)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 |
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 ;; ************************** Compatibility *************************** |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 ;; |
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 ;;; Old Style Brute Force Search Routines |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 ;; 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
|
434 ;; desired information. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;; 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
|
437 ;; `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
|
438 ;; 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
|
439 ;; 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
|
440 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 (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
|
442 (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
|
443 "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
|
444 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
|
445 If SEARCH-INCLUDE was never implemented. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 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
|
448 (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
|
449 (assoc-fun (if semantic-case-fold |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 #'assoc-ignore-case |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 #'assoc)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (m (funcall assoc-fun name stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (if m |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 m |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (let ((toklst stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (children nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (while (and (not m) toklst) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (if search-parts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (progn |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (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
|
461 (car toklst))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (if children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (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
|
464 name children search-parts search-include))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (setq toklst (cdr toklst))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (if (not m) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 ;; Go to dependencies, and search there. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 m)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (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
|
472 (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
|
473 "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
|
474 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
|
475 See `semantic-tag-class'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 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
|
477 `semantic-brute-find-tag-by-function'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 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
|
480 `(semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 (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
|
482 ,streamorbuffer ,search-parts ,search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 (defmacro semantic-brute-find-tag-standard |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (streamorbuffer &optional search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 "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
|
487 See `semantic-tag-class'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 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
|
489 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 `(semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 (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
|
492 '(function variable type))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 ,streamorbuffer ,search-parts ,search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (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
|
496 (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
|
497 "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
|
498 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
|
499 See `semantic-tag-type'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 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
|
501 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (lambda (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (let ((ts (semantic-tag-type tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (if (and (listp ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (or (= (length ts) 1) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (eq (semantic-tag-class ts) 'type))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (setq ts (semantic-tag-name ts))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 (equal type ts))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 streamorbuffer search-parts search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 (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
|
513 (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
|
514 "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
|
515 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
|
516 tags returned. See `semantic-tag-type'. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 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
|
518 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (lambda (tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 (let ((ts (semantic-tag-type tag))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (if (listp ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (setq ts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (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
|
525 (semantic-tag-name ts) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (car ts)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (and ts (string-match regexp ts)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 streamorbuffer search-parts search-includes)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 (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
|
531 (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
|
532 "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
|
533 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
|
534 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (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
|
537 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 (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
|
541 (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
|
542 "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
|
543 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
|
544 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (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
|
547 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (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
|
551 (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
|
552 "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
|
553 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
|
554 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
|
555 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (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
|
558 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 (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
|
562 (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
|
563 "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
|
564 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
|
565 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
|
566 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
|
567 `semantic-brute-find-tag-by-function'." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 (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
|
570 streamorbuffer search-parts search-includes) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (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
|
574 (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
|
575 "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
|
576 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
|
577 in the new list. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 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
|
580 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
|
581 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
|
582 '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
|
583 searched. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 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
|
586 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
|
587 (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
|
588 (sl nil) ;list of tag children |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (nl nil) ;new list |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 (case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (dolist (tag stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (if (not (semantic-tag-p tag)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 ;; `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
|
594 ;; 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
|
595 nil ;; Ignore them! |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (if (funcall function tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (setq nl (cons tag nl))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (and search-parts |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (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
|
600 (semantic-tag-components-with-overlays tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (semantic-tag-components tag)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 (setq nl (nconc nl |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (semantic-brute-find-tag-by-function |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 function sl |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 search-parts)))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 (setq nl (nreverse nl)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 nl)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 (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
|
611 (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
|
612 "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
|
613 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
|
614 in the new list. |
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 The following parameters were never implemented. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 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
|
619 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
|
620 searching. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 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
|
622 searched for matches." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (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
|
624 (found nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 (case-fold-search semantic-case-fold)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 (while (and (not found) stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 (if (funcall function (car stream)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 (setq found (car stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 (setq stream (cdr stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 found)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 |
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 ;;; Old Positional Searches |
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 ;; Are these useful anymore? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (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
|
638 &optional nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 "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
|
640 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
|
641 the median calculation, and return nil." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 (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
|
644 (let* ((stream (if (bufferp streamorbuffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 (save-excursion |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 (set-buffer streamorbuffer) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 (semantic-fetch-tags)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 streamorbuffer)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 (prev nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 (found nil)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 (while (and stream (not found)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 ;; perfect fit |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 (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
|
654 (<= position (semantic-tag-end (car stream)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 (setq found (car stream)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 ;; Median between to objects. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 (if (and prev (not nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (>= position (semantic-tag-end prev)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 (<= position (semantic-tag-start (car stream)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 (let ((median (/ (+ (semantic-tag-end prev) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 (semantic-tag-start (car stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 2))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 (setq found |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 (if (> position median) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 (car stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 prev))))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 ;; Next!!! |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 (setq prev (car stream) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 stream (cdr stream))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 found))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 (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
|
673 (position streamorbuffer &optional nomedian) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 "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
|
675 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
|
676 the median calculation, and return nil. |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 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
|
678 details are available of findable." |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 (let* ((returnme nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 (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
|
681 position streamorbuffer nomedian)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (nextstream (and current |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 (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
|
684 (semantic-tag-type-members current) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (while nextstream |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 (setq returnme (cons current returnme)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (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
|
689 position nextstream nomedian)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 (setq nextstream (and current |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 ;; NOTE TO SELF: |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 ;; 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
|
693 ;; what does this do??? |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 (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
|
695 (semantic-tag-type-members current) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 nil)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 (nreverse (cons current returnme)))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 ;;; Compatibility Aliases |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 (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
|
701 'semantic-find-tag-by-overlay) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 (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
|
704 '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
|
705 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 (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
|
707 'semantic-find-tag-by-overlay-next) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 (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
|
710 'semantic-find-tag-by-overlay-prev) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 (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
|
713 'semantic-find-tag-parent-by-overlay) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 (semantic-alias-obsolete 'semantic-current-nonterminal |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 'semantic-current-tag) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 (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
|
719 'semantic-current-tag-parent) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 (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
|
722 'semantic-current-tag-of-class) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 (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
|
725 '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
|
726 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 (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
|
728 'semantic-brute-find-tag-by-class) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 (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
|
731 'semantic-brute-find-tag-standard) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 (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
|
734 'semantic-brute-find-tag-by-type) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 (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
|
737 '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
|
738 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 (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
|
740 '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
|
741 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 (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
|
743 'semantic-brute-find-tag-by-property) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 (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
|
746 'semantic-brute-find-tag-by-attribute) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 (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
|
749 '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
|
750 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 (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
|
752 'semantic-brute-find-tag-by-function) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 (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
|
755 '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
|
756 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 (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
|
758 'semantic-brute-find-tag-by-position) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 (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
|
761 '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
|
762 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 ;;; TESTING |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 ;; |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 (defun semantic-find-benchmark () |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 "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
|
767 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
|
768 (interactive) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 (require 'benchmark) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 (let ((f-name nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 (b-name nil) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 (f-comp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 (b-comp) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 (f-regex) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 ) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 (setq f-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 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
|
780 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 (setq b-name |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 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
|
785 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 (setq f-comp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 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
|
790 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 (setq b-comp |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 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
|
795 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 (garbage-collect) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 (setq f-regex |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 (benchmark-run-compiled |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 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
|
800 "test/test.cpp"))) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (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
|
803 (car f-name) (car b-name) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 (car f-comp) (car f-regex) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 (car b-comp)) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 )) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 (provide 'semantic/find) |
6810f0d84270
cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
810 ;; Local variables: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
811 ;; 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
|
812 ;; generated-autoload-feature: semantic/loaddefs |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104446
diff
changeset
|
813 ;; generated-autoload-load-name: "semantic/find" |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
814 ;; End: |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
815 |
104442
b22b44e953cb
cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents:
104417
diff
changeset
|
816 ;;; semantic/find.el ends here |