123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- (require 'semantic/tag)
- (defvar ede-minor-mode)
- (declare-function semanticdb-table-child-p "semantic/db" t t)
- (declare-function semanticdb-get-buffer "semantic/db")
- (declare-function semantic-dependency-find-file-on-path "semantic/dep")
- (declare-function ede-toplevel "ede/base")
- (define-overloadable-function semantic-go-to-tag (tag &optional parent)
- "Go to the location of TAG.
- TAG may be a stripped element, in which case PARENT specifies a
- parent tag that has position information.
- PARENT can also be a `semanticdb-table' object."
- (:override
- (save-match-data
- (cond ((semantic-tag-in-buffer-p tag)
-
- (set-buffer (semantic-tag-buffer tag)))
- ((semantic-tag-file-name tag)
-
-
-
- (set-buffer (find-file-noselect (semantic-tag-file-name tag))))
- ((and parent (semantic-tag-p parent) (semantic-tag-in-buffer-p parent))
-
-
- (set-buffer (semantic-tag-buffer parent)))
- ((and parent (semantic-tag-p parent) (semantic-tag-file-name parent))
-
-
- (set-buffer (find-file-noselect (semantic-tag-file-name parent))))
- ((and parent (featurep 'semantic/db)
- (semanticdb-table-child-p parent))
- (set-buffer (semanticdb-get-buffer parent)))
- (t
-
- nil
- )))
-
-
- (cond ((semantic-tag-with-position-p tag)
-
- (goto-char (semantic-tag-start tag)))
- ((semantic-tag-with-position-p parent)
-
-
-
- (goto-char (semantic-tag-start parent))
-
-
-
- (re-search-forward (semantic-tag-name tag)
- (semantic-tag-end parent)
- t))
- ((semantic-tag-get-attribute tag :line)
-
- (goto-char (point-min))
- (forward-line (1- (semantic-tag-get-attribute tag :line))))
- ((and (semantic-tag-p parent) (semantic-tag-get-attribute parent :line))
-
- (goto-char (point-min))
- (forward-line (1- (semantic-tag-get-attribute parent :line)))
- (re-search-forward (semantic-tag-name tag) nil t))
- (t
-
-
- (goto-char (point-min))
- (re-search-forward (semantic-tag-name tag) nil t)))
- )
- )
- (make-obsolete-overload 'semantic-find-nonterminal
- 'semantic-go-to-tag "23.2")
- (define-overloadable-function semantic-dependency-tag-file (&optional tag)
- "Find the filename represented from TAG.
- Depends on `semantic-dependency-include-path' for searching. Always searches
- `.' first, then searches additional paths."
- (or tag (setq tag (car (semantic-find-tag-by-overlay nil))))
- (unless (semantic-tag-of-class-p tag 'include)
- (signal 'wrong-type-argument (list tag 'include)))
- (save-excursion
- (let ((result nil)
- (default-directory default-directory)
- (edefind nil)
- (tag-fname nil))
- (cond ((semantic-tag-in-buffer-p tag)
-
-
- (set-buffer (semantic-tag-buffer tag)))
- ((semantic-tag-file-name tag)
-
-
-
-
-
-
-
-
- (setq default-directory (file-name-directory (semantic-tag-file-name tag)))
- ))
-
- (setq tag-fname (semantic-tag-include-filename tag))
-
- (if (and (fboundp 'ede-expand-filename) ede-minor-mode
- (setq edefind
- (condition-case nil
- (let ((proj (ede-toplevel)))
- (when proj
- (ede-expand-filename proj tag-fname)))
- (error nil))))
- (setq result edefind))
- (if (not result)
- (setq result
-
-
-
-
-
- (:override
- (save-excursion
- (require 'semantic/dep)
- (semantic-dependency-find-file-on-path
- tag-fname (semantic-tag-include-system-p tag))))
-
- ))
- (if (stringp result)
- (progn
- (semantic--tag-put-property tag 'dependency-file result)
- result)
-
-
-
-
- nil)
- )))
- (make-obsolete-overload 'semantic-find-dependency
- 'semantic-dependency-tag-file "23.2")
- (define-overloadable-function semantic-prototype-file (buffer)
- "Return a file in which prototypes belonging to BUFFER should be placed.
- Default behavior (if not overridden) looks for a token specifying the
- prototype file, or the existence of an EDE variable indicating which
- file prototypes belong in."
- (:override
-
- (if (and (fboundp 'ede-header-file) ede-minor-mode)
- (with-current-buffer buffer
- (ede-header-file))
-
- (with-current-buffer buffer
- (if (re-search-forward "::Header:: \\([a-zA-Z0-9.]+\\)" nil t)
- (match-string 1))))))
- (semantic-alias-obsolete 'semantic-find-nonterminal
- 'semantic-go-to-tag "23.2")
- (semantic-alias-obsolete 'semantic-find-dependency
- 'semantic-dependency-tag-file "23.2")
- (provide 'semantic/tag-file)
|