annotate lisp/cedet/semantic/tag-file.el @ 105760:d0906291f75b

* cedet/semantic/fw.el (semantic-alias-obsolete) (semantic-varalias-obsolete): Make the `when' arg mandatory. (define-mode-overload-implementation): * cedet/semantic/decorate/mode.el (semantic-decorate-pending-decoration-hooks): * cedet/semantic/wisent.el (wisent-lex-make-token-table): * cedet/semantic/util.el (semantic-file-token-stream) (semantic-something-to-stream): * cedet/semantic/tag.el (semantic-tag-make-assoc-list) (semantic-expand-nonterminal): * cedet/semantic/tag-file.el (semantic-find-nonterminal) (semantic-find-dependency, semantic-find-nonterminal) (semantic-find-dependency): * cedet/semantic/lex.el (semantic-flex-start, semantic-flex-end) (semantic-flex-text, semantic-flex-make-keyword-table) (semantic-flex-keyword-p, semantic-flex-keyword-put) (semantic-flex-keyword-get, semantic-flex-map-keywords) (semantic-flex-keywords, semantic-flex-buffer, semantic-flex-list): * cedet/semantic/java.el (semantic-java-prototype-nonterminal): * cedet/semantic/idle.el (semantic-before-idle-scheduler-reparse-hooks) (semantic-after-idle-scheduler-reparse-hooks): * cedet/semantic/edit.el (semantic-edits-incremental-reparse-failed-hooks): * cedet/semantic/db-mode.el (semanticdb-mode-hooks): * cedet/semantic.el (semantic-toplevel-bovine-table) (semantic-toplevel-bovine-cache) (semantic-before-toplevel-bovination-hook, semantic-init-hooks) (semantic-init-mode-hooks, semantic-init-db-hooks) (semantic-bovination-working-type): Provide the `when' arg.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 25 Oct 2009 02:55:27 +0000
parents 7f4c7f5c0eba
children 3fe6da4a95a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
1 ;;; semantic/tag-file.el --- Routines that find files based on tags.
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
105279
6969c5b2e0b2 Mark declarations not understood by check-declare.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
6969c5b2e0b2 Mark declarations not understood by check-declare.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
4 ;; 2009 Free Software Foundation, Inc.
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Keywords: syntax
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; (at your option) any later version.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; A tag, by itself, can have representations in several files.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; These routines will find those files.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 (require 'semantic/tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30
104455
d66016869489 lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag): Require
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
31 (defvar ede-minor-mode)
105279
6969c5b2e0b2 Mark declarations not understood by check-declare.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
32 (declare-function semanticdb-table-child-p "semantic/db" t t)
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
33 (declare-function semanticdb-get-buffer "semantic/db")
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
34 (declare-function semantic-dependency-find-file-on-path "semantic/dep")
104455
d66016869489 lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag): Require
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
35 (declare-function ede-toplevel "ede/files")
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
36
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;;; Code:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 ;;; Location a TAG came from.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 ;;
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
41 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 (define-overloadable-function semantic-go-to-tag (tag &optional parent)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 "Go to the location of TAG.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 TAG may be a stripped element, in which case PARENT specifies a
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 parent tag that has position information.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 PARENT can also be a `semanticdb-table' object."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (:override
104492
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
48 (save-match-data
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
49 (cond ((semantic-tag-in-buffer-p tag)
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
50 ;; We have a linked tag, go to that buffer.
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
51 (set-buffer (semantic-tag-buffer tag)))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
52 ((semantic-tag-file-name tag)
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
53 ;; If it didn't have a buffer, but does have a file
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
54 ;; name, then we need to get to that file so the tag
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
55 ;; location is made accurate.
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
56 (set-buffer (find-file-noselect (semantic-tag-file-name tag))))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
57 ((and parent (semantic-tag-p parent) (semantic-tag-in-buffer-p parent))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
58 ;; The tag had nothing useful, but we have a parent with
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
59 ;; a buffer, then go there.
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
60 (set-buffer (semantic-tag-buffer parent)))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
61 ((and parent (semantic-tag-p parent) (semantic-tag-file-name parent))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
62 ;; Tag had nothing, and the parent only has a file-name, then
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
63 ;; find that file, and switch to that buffer.
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
64 (set-buffer (find-file-noselect (semantic-tag-file-name parent))))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
65 ((and parent (featurep 'semantic/db)
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
66 (semanticdb-table-child-p parent))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
67 (set-buffer (semanticdb-get-buffer parent)))
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
68 (t
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
69 ;; Well, just assume things are in the current buffer.
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
70 nil
8db96f200ac8 Synch to Eric Ludlam's upstream CEDET repository.
Chong Yidong <cyd@stupidchicken.com>
parents: 104455
diff changeset
71 )))
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;; We should be in the correct buffer now, try and figure out
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 ;; where the tag is.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (cond ((semantic-tag-with-position-p tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 ;; If it's a number, go there
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 (goto-char (semantic-tag-start tag)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ((semantic-tag-with-position-p parent)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 ;; Otherwise, it's a trimmed vector, such as a parameter,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 ;; or a structure part. If there is a parent, we can use it
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; as a bounds for searching.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 (goto-char (semantic-tag-start parent))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 ;; Here we make an assumption that the text returned by
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 ;; the parser and concocted by us actually exists
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 ;; in the buffer.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (re-search-forward (semantic-tag-name tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 (semantic-tag-end parent)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 t))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ((semantic-tag-get-attribute tag :line)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;; The tag has a line number in it. Go there.
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104492
diff changeset
90 (goto-char (point-min))
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104492
diff changeset
91 (forward-line (1- (semantic-tag-get-attribute tag :line))))
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 ((and (semantic-tag-p parent) (semantic-tag-get-attribute parent :line))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 ;; The tag has a line number in it. Go there.
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104492
diff changeset
94 (goto-char (point-min))
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104492
diff changeset
95 (forward-line (1- (semantic-tag-get-attribute parent :line)))
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104492
diff changeset
96 (re-search-forward (semantic-tag-name tag) nil t))
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (t
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 ;; Take a guess that the tag has a unique name, and just
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 ;; search for it from the beginning of the buffer.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (goto-char (point-min))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (re-search-forward (semantic-tag-name tag) nil t)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (make-obsolete-overload 'semantic-find-nonterminal
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
106 'semantic-go-to-tag "23.2")
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 ;;; Dependencies
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; A tag which is of type 'include specifies a dependency.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 ;; Dependencies usually represent a file of some sort.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 ;; Find the file described by a dependency.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
114 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (define-overloadable-function semantic-dependency-tag-file (&optional tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 "Find the filename represented from TAG.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 Depends on `semantic-dependency-include-path' for searching. Always searches
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 `.' first, then searches additional paths."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (or tag (setq tag (car (semantic-find-tag-by-overlay nil))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (unless (semantic-tag-of-class-p tag 'include)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (signal 'wrong-type-argument (list tag 'include)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (let ((result nil)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (default-directory default-directory)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (edefind nil)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (tag-fname nil))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (cond ((semantic-tag-in-buffer-p tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 ;; If the tag has an overlay and buffer associated with it,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ;; switch to that buffer so that we get the right override metohds.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (set-buffer (semantic-tag-buffer tag)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 ((semantic-tag-file-name tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 ;; If it didn't have a buffer, but does have a file
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 ;; name, then we need to get to that file so the tag
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 ;; location is made accurate.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ;;(set-buffer (find-file-noselect (semantic-tag-file-name tag)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;; 2/3/08
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 ;; The above causes unnecessary buffer loads all over the place. Ick!
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 ;; All we really need is for 'default-directory' to be set correctly.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (setq default-directory (file-name-directory (semantic-tag-file-name tag)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 ))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 ;; Setup the filename represented by this include
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (setq tag-fname (semantic-tag-include-filename tag))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 ;; First, see if this file exists in the current EDE project
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (if (and (fboundp 'ede-expand-filename) ede-minor-mode
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (setq edefind
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (condition-case nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (let ((proj (ede-toplevel)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (when proj
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (ede-expand-filename proj tag-fname)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (error nil))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (setq result edefind))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (if (not result)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (setq result
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 ;; I don't have a plan for refreshing tags with a dependency
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 ;; stuck on them somehow. I'm thinking that putting a cache
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 ;; onto the dependancy finding with a hash table might be best.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 ;;(if (semantic--tag-get-property tag 'dependency-file)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ;; (semantic--tag-get-property tag 'dependency-file)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (:override
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (save-excursion
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
163 (require 'semantic/dep)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 (semantic-dependency-find-file-on-path
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 tag-fname (semantic-tag-include-system-p tag))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 ;; )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 ))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (if (stringp result)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (progn
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 (semantic--tag-put-property tag 'dependency-file result)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 result)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 ;; @todo: Do something to make this get flushed w/
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 ;; when the path is changed.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 ;; @undo: Just eliminate
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 ;; (semantic--tag-put-property tag 'dependency-file 'none)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 nil)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (make-obsolete-overload 'semantic-find-dependency
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
180 'semantic-dependency-tag-file "23.2")
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 ;;; PROTOTYPE FILE
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 ;; In C, a function in the .c file often has a representation in a
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 ;; corresponding .h file. This routine attempts to find the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 ;; prototype file a given source file would be associated with.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 ;; This can be used by prototype manager programs.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (define-overloadable-function semantic-prototype-file (buffer)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 "Return a file in which prototypes belonging to BUFFER should be placed.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 Default behavior (if not overridden) looks for a token specifying the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 prototype file, or the existence of an EDE variable indicating which
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 file prototypes belong in."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (:override
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 ;; Perform some default behaviors
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (if (and (fboundp 'ede-header-file) ede-minor-mode)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (set-buffer buffer)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (ede-header-file))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 ;; No EDE options for a quick answer. Search.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (set-buffer buffer)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 (if (re-search-forward "::Header:: \\([a-zA-Z0-9.]+\\)" nil t)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (match-string 1))))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (semantic-alias-obsolete 'semantic-find-nonterminal
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
206 'semantic-go-to-tag "23.2")
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (semantic-alias-obsolete 'semantic-find-dependency
105760
d0906291f75b * cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
209 'semantic-dependency-tag-file "23.2")
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (provide 'semantic/tag-file)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
214 ;; Local variables:
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
215 ;; generated-autoload-file: "loaddefs.el"
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
216 ;; 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
217 ;; generated-autoload-load-name: "semantic/tag-file"
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
218 ;; End:
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
219
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105279
diff changeset
220 ;; arch-tag: 71d4cf18-c1ec-414c-bb0a-c2ed914c1361
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
221 ;;; semantic/tag-file.el ends here