annotate lisp/cedet/semantic/format.el @ 104442:b22b44e953cb

cedet/semantic/chart.el: Don't require semantic/find. cedet/semantic/complete.el: Don't require semantic/find. cedet/semantic/decorate.el: Require semantic/tag-file. (semantic-set-tag-folded-isearch): Require semantic/find. cedet/semantic/dep.el: Change semantic--dependency-find-file-on-path into a macro, to avoid compiler warning. Defvar ede-minor-mode and ede-object. Declare ede-system-include-path. cedet/semantic/doc.el: Require semantic/tag-file and semantic/find. cedet/semantic/edit.el: Require semantic/find and semantic/format. cedet/semantic/find.el: Defvar semantic-case-fold. Require semantic. (semantic-find-tags-external-children-of-type): Require semantic/sort. (semantic-find-tags-by-scope-protection-default): Require semantic/tag-ls. cedet/semantic/format.el: Require semantic/tag-ls. eval-when-compile semantic/find. (semantic-format-tag-name): Move up to avoid compiler error. (semantic-format-tag-prototype): Move up to avoid compiler error. (semantic--format-tag-parent-tree): Require semantic/tag-file. (semantic-format-tag-short-doc-default): Require semantic/doc.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 31 Aug 2009 02:16:34 +0000
parents 6810f0d84270
children 2bf481006ba4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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/format.el --- Routines for formatting tags
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, 2007,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;; 2008, 2009 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 ;; Once a language file has been parsed into a TAG, it is often useful
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; then display that tag information in browsers, completion engines, or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; help routines. The functions and setup in this file provide ways
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; to reformat a tag into different standard output types.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; In addition, macros for setting up customizable variables that let
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; the user choose their default format type are also provided.
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;;; Code:
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
36 (require 'semantic)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (require 'semantic/tag)
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
38 (require 'semantic/tag-ls)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (require 'ezimage)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
41 (eval-when-compile
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
42 (require 'font-lock)
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
43 (require 'semantic/find))
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
44
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ;;; Tag to text overload functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 ;; abbreviations, prototypes, and coloring support.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (defvar semantic-format-tag-functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 '(semantic-format-tag-name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 semantic-format-tag-canonical-name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 semantic-format-tag-abbreviate
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 semantic-format-tag-summarize
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 semantic-format-tag-summarize-with-file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 semantic-format-tag-short-doc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 semantic-format-tag-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 semantic-format-tag-concise-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 semantic-format-tag-uml-abbreviate
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 semantic-format-tag-uml-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 semantic-format-tag-uml-concise-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 semantic-format-tag-prin1
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 "List of functions which convert a tag to text.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 Each function must take the parameters TAG &optional PARENT COLOR.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 TAG is the tag to convert.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 PARENT is a parent tag or name which refers to the structure
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 or class which contains TAG. PARENT is NOT a class which a TAG
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 would claim as a parent.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 COLOR indicates that the generated text should be colored using
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 `font-lock'.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 (semantic-varalias-obsolete 'semantic-token->text-functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 'semantic-format-tag-functions)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 (defvar semantic-format-tag-custom-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (append '(radio)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 (mapcar (lambda (f) (list 'const f))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 semantic-format-tag-functions)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 '(function))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 "A List used by customizeable variables to choose a tag to text function.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 Use this variable in the :type field of a customizable variable.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 (semantic-varalias-obsolete 'semantic-token->text-custom-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 'semantic-format-tag-custom-list)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (defcustom semantic-format-use-images-flag ezimage-use-images
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 "Non-nil means semantic format functions use images.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 Images can be used as icons instead of some types of text strings."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 :type 'boolean)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (defvar semantic-function-argument-separator ","
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 "Text used to separate arguments when creating text from tags.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (make-variable-buffer-local 'semantic-function-argument-separator)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (defvar semantic-format-parent-separator "::"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 "Text used to separate names when between namespaces/classes and functions.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (make-variable-buffer-local 'semantic-format-parent-separator)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
98 (define-overloadable-function semantic-format-tag-name (tag &optional parent color)
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
99 "Return the name string describing TAG.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
100 The name is the shortest possible representation.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
101 Optional argument PARENT is the parent type if TAG is a detail.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
102 Optional argument COLOR means highlight the prototype with font-lock colors.")
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
103
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
104 (define-overloadable-function semantic-format-tag-prototype (tag &optional parent color)
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
105 "Return a prototype for TAG.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
106 This function should be overloaded, though it need not be used.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
107 This is because it can be used to create code by language independent
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
108 tools.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
109 Optional argument PARENT is the parent type if TAG is a detail.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
110 Optional argument COLOR means highlight the prototype with font-lock colors.")
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
111
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
112
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (defun semantic-test-all-format-tag-functions (&optional arg)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 "Test all outputs from `semantic-format-tag-functions'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 Output is generated from the function under `point'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 Optional argument ARG specifies not to use color."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (interactive "P")
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
118 (require 'semantic/find)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (semantic-fetch-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (let* ((tag (semantic-current-tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (par (semantic-current-tag-parent))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (fns semantic-format-tag-functions))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (with-output-to-temp-buffer "*format-tag*"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (princ "Tag->format function tests:")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (while fns
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (princ "\n")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (princ (car fns))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (princ ":\n ")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (let ((s (funcall (car fns) tag par (not arg))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (set-buffer "*format-tag*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (goto-char (point-max))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (insert s)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (setq fns (cdr fns))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (defvar semantic-format-face-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 `( (function . font-lock-function-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (variable . font-lock-variable-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (type . font-lock-type-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 ;; These are different between Emacsen.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (include . ,(if (featurep 'xemacs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 'font-lock-preprocessor-face
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 'font-lock-constant-face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (package . ,(if (featurep 'xemacs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 'font-lock-preprocessor-face
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 'font-lock-constant-face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 ;; Not a tag, but instead a feature of output
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (label . font-lock-string-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (comment . font-lock-comment-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (keyword . font-lock-keyword-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (abstract . italic)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (static . underline)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (documentation . font-lock-doc-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 "Face used to colorize tags of different types.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 Override the value locally if a language supports other tag types.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 When adding new elements, try to use symbols also returned by the parser.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 The form of an entry in this list is of the form:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ( SYMBOL . FACE )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 where SYMBOL is a tag type symbol used with semantic. FACE
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 is a symbol representing a face.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 Faces used are generated in `font-lock' for consistency, and will not
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 be used unless font lock is a feature.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 (semantic-varalias-obsolete 'semantic-face-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 'semantic-format-face-alist)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 ;;; Coloring Functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 (defun semantic--format-colorize-text (text face-class)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 "Apply onto TEXT a color associated with FACE-CLASS.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 FACE-CLASS is a tag type found in `semantic-face-alist'. See this variable
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 for details on adding new types."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (if (featurep 'font-lock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (newtext (concat text)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (put-text-property 0 (length text) 'face face newtext)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 newtext)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 text))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (make-obsolete 'semantic-colorize-text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 'semantic--format-colorize-text)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (defun semantic--format-colorize-merge-text (precoloredtext face-class)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 "Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 FACE-CLASS is a tag type found in 'semantic-face-alist'. See this
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 variable for details on adding new types."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (newtext (concat precoloredtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (if (featurep 'xemacs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (add-text-properties 0 (length newtext) (list 'face face) newtext)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (alter-text-property 0 (length newtext) 'face
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (lambda (current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (let ((cf
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (cond ((facep current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (list current-face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 ((listp current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (t nil)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (nf
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (cond ((facep face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (list face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 ((listp face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (t nil))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (append cf nf)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 newtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 newtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 ;;; Function Arguments
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 (defun semantic--format-tag-arguments (args formatter color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 "Format the argument list ARGS with FORMATTER.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 FORMATTER is a function used to format a tag.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 COLOR specifies if color should be used."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (let ((out nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (while args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (push (if (and formatter
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (semantic-tag-p (car args))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (not (string= (semantic-tag-name (car args)) ""))
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 (funcall formatter (car args) nil color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (semantic-format-tag-name-from-anything
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (car args) nil color 'variable))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (setq args (cdr args)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (mapconcat 'identity (nreverse out) semantic-function-argument-separator)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 ;;; Data Type
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (define-overloadable-function semantic-format-tag-type (tag color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 "Convert the data type of TAG to a string usable in tag formatting.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 It is presumed that TYPE is a string or semantic tag.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (defun semantic-format-tag-type-default (tag color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 "Convert the data type of TAG to a string usable in tag formatting.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 Argument COLOR specifies to colorize the text."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (let* ((type (semantic-tag-type tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (out (cond ((semantic-tag-p type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (let* ((typetype (semantic-tag-type type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 (name (semantic-tag-name type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 (str (if typetype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 (concat typetype " " name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (semantic--format-colorize-text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 str)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 ((and (listp type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (stringp (car type)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 (car type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 ((stringp type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (t nil))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (if (and color out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (setq out (semantic--format-colorize-text out 'type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 ;;; Abstract formatting functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (defun semantic-format-tag-prin1 (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 "Convert TAG to a string that is the print name for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 PARENT and COLOR are ignored."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (format "%S" tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (defun semantic-format-tag-name-from-anything (anything &optional
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 parent color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 colorhint)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 "Convert just about anything into a name like string.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 Argument ANYTHING is the thing to be converted.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 Optional argument COLOR means highlight the prototype with font-lock colors.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 Optional COLORHINT is the type of color to use if ANYTHING is not a tag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 with a tag class. See `semantic--format-colorize-text' for a definition
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 of FACE-CLASS for which this is used."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (cond ((stringp anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (semantic--format-colorize-text anything colorhint))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 ((semantic-tag-p anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (let ((ans (semantic-format-tag-name anything parent color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 ;; If ANS is empty string or nil, then the name wasn't
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 ;; supplied. The implication is as in C where there is a data
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 ;; type but no name for a prototype from an include file, or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 ;; an argument just wasn't used in the body of the fcn.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (if (or (null ans) (string= ans ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (setq ans (semantic-format-tag-type anything color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 ans))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 ((and (listp anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 (stringp (car anything)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (semantic--format-colorize-text (car anything) colorhint))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (defun semantic-format-tag-name-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (let ((name (semantic-tag-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 (destructor
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 (if (eq (semantic-tag-class tag) 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (semantic-tag-function-destructor-p tag))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (when destructor
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (setq name (concat "~" name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (setq name (semantic--format-colorize-text name (semantic-tag-class tag))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
312 (declare-function semantic-go-to-tag "semantic/tag-file")
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
313
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 (defun semantic--format-tag-parent-tree (tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 "Under Consideration.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 Return a list of parents for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 PARENT is the first parent, or nil. If nil, then an attempt to
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 determine PARENT is made.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 Once PARENT is identified, additional parents are looked for.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 The return list first element is the nearest parent, and the last
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 item is the first parent which may be a string. The root parent may
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 not be the actual first parent as there may just be a failure to find
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 local definitions."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 ;; First, validate the PARENT argument.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 (unless parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 ;; All mechanisms here must be fast as often parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 ;; is nil because there isn't one.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (setq parent (or (semantic-tag-function-parent tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (save-excursion
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
331 (require 'semantic/tag-file)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (semantic-go-to-tag tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (semantic-current-tag-parent)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (when (stringp parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (setq parent (semantic-find-first-tag-by-name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 parent (current-buffer))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 ;; Try and find a trail of parents from PARENT
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (let ((rlist (list parent))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 ;; IMPLELEMENT ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (reverse rlist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (define-overloadable-function semantic-format-tag-canonical-name (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 "Return a canonical name for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 A canonical name includes the names of any parents or namespaces preceeding
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 the tag.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (defun semantic-format-tag-canonical-name-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 "Return a canonical name for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 A canonical name includes the names of any parents or namespaces preceeding
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 the tag with colons separating them.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (let ((parent-input-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 (if (and parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (semantic-tag-p parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (semantic-tag-of-class-p parent 'type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (concat
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 ;; Choose a class of 'type as the default parent for something.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 ;; Just a guess though.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (semantic-format-tag-name-from-anything parent nil color 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 ;; Default separator between class/namespace and others.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 semantic-format-parent-separator)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 (tag-parent-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 (or (when (and (semantic-tag-of-class-p tag 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (semantic-tag-function-parent tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (concat (semantic-tag-function-parent tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 semantic-format-parent-separator))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 ""))
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 (concat parent-input-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 tag-parent-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (semantic-format-tag-name tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (define-overloadable-function semantic-format-tag-abbreviate (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 The abbreviation is to be short, with possible symbols indicating
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 the type of tag, or other information.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 (defun semantic-format-tag-abbreviate-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 Optional argument PARENT is a parent tag in the tag hierarchy.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 In this case PARENT refers to containment, not inheritance.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 Optional argument COLOR means highlight the prototype with font-lock colors.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 This is a simple C like default."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 ;; Do lots of complex stuff here.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 (let ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 (name (semantic-format-tag-canonical-name tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 (suffix "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (prefix "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 str)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (cond ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (setq suffix "()"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 ((eq class 'include)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (setq suffix "<>"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 ((eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (setq suffix (if (semantic-tag-variable-default tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 "=" "")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 ((eq class 'label)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (setq suffix ":"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 ((eq class 'code)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (setq prefix "{"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 suffix "}"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (setq suffix "{}"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (setq str (concat prefix name suffix))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 str))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 ;; Semantic 1.2.x had this misspelling. Keep it for backwards compatibiity.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 (semantic-alias-obsolete
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 'semantic-summerize-nonterminal 'semantic-format-tag-summarize)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 (define-overloadable-function semantic-format-tag-summarize (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 (defun semantic-format-tag-summarize-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (let* ((proto (semantic-format-tag-prototype tag nil color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 (names (if parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 semantic-symbol->name-assoc-list-for-type-parts
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 semantic-symbol->name-assoc-list))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (tsymb (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (label (capitalize (or (cdr-safe (assoc tsymb names))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (symbol-name tsymb)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (setq label (semantic--format-colorize-text label 'label)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (concat label ": " proto)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (define-overloadable-function semantic-format-tag-summarize-with-file (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 "Like `semantic-format-tag-summarize', but with the file name.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 (defun semantic-format-tag-summarize-with-file-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (let* ((proto (semantic-format-tag-prototype tag nil color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 (file (semantic-tag-file-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 ;; Nothing for tag? Try parent.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 (when (and (not file) (and parent))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 (setq file (semantic-tag-file-name parent)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 ;; Don't include the file name if we can't find one, or it is the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 ;; same as the current buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 (if (or (not file)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (string= file (buffer-file-name (current-buffer))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 proto
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (setq file (file-name-nondirectory file))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (when color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (setq file (semantic--format-colorize-text file 'label)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 (concat file ": " proto))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (define-overloadable-function semantic-format-tag-short-doc (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 "Display a short form of TAG's documentation. (Comments, or docstring.)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
470 (declare-function semantic-documentation-for-tag "semantic/doc")
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
471
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 (defun semantic-format-tag-short-doc-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 "Display a short form of TAG's documentation. (Comments, or docstring.)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 Optional argument COLOR means highlight the prototype with font-lock colors."
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
476
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 (let* ((fname (or (semantic-tag-file-name tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 (when parent (semantic-tag-file-name parent))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 (buf (or (semantic-tag-buffer tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 (when parent (semantic-tag-buffer parent))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 (doc (semantic-tag-docstring tag buf)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 (when (and (not doc) (not buf) fname)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 ;; If there is no doc, and no buffer, but we have a filename,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 ;; lets try again.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (setq buf (find-file-noselect fname))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 (setq doc (semantic-tag-docstring tag buf)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (when (not doc)
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
488 (require 'semantic/doc)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (setq doc (semantic-documentation-for-tag tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (setq doc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (if (not doc)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 ;; No doc, use summarize.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 (semantic-format-tag-summarize tag parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 ;; We have doc. Can we devise a single line?
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (if (string-match "$" doc)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 (substring doc 0 (match-beginning 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 doc)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (when color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (setq doc (semantic--format-colorize-text doc 'documentation)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 doc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 ;;; Prototype generation
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 (defun semantic-format-tag-prototype-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 "Default method for returning a prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 This will work for C like languages.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 (let* ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 (name (semantic-format-tag-name tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 (type (if (member class '(function variable type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (semantic-format-tag-type tag color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 (args (if (member class '(function type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (semantic--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 (if (eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 (list "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 ;;(semantic-tag-type-members tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 #'semantic-format-tag-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (const (semantic-tag-get-attribute tag :constant-flag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (tm (semantic-tag-get-attribute tag :typemodifiers))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (mods (append
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 (if const '("const") nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 (cond ((stringp tm) (list tm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 ((consp tm) tm)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 (t nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 (array (if (eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 (let ((deref
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 (semantic-tag-get-attribute
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 tag :dereference))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 (r ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (while (and deref (/= deref 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 (setq r (concat r "[]")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 deref (1- deref)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 r)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 (if args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 (setq args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 (concat " "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 (if (eq class 'type) "{" "(")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 (if (eq class 'type) "}" ")"))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 (when mods
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 (setq mods (concat (mapconcat 'identity mods " ") " ")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 (concat (or mods "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 (if type (concat type " "))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 (or args "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 (or array ""))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (define-overloadable-function semantic-format-tag-concise-prototype (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 "Return a concise prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 (defun semantic-format-tag-concise-prototype-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 "Return a concise prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 This default function will make a cheap concise prototype using C like syntax.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (let ((class (semantic-tag-class tag)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 (cond
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 (concat (semantic-format-tag-name tag parent color) "{}"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 (concat (semantic-format-tag-name tag parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 " ("
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 (semantic--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 'semantic-format-tag-concise-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 color)
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 ((eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 (let* ((deref (semantic-tag-get-attribute
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 tag :dereference))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 (array "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (while (and deref (/= deref 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (setq array (concat array "[]")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 deref (1- deref)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (concat (semantic-format-tag-name tag parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 array)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 (t
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 (semantic-format-tag-abbreviate tag parent color)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 ;;; UML display styles
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 (defcustom semantic-uml-colon-string " : "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 "*String used as a color separator between parts of a UML string.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 In UML, a variable may appear as `varname : type'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 Change this variable to change the output separator."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 :type 'string)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (defcustom semantic-uml-no-protection-string ""
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 "*String used to describe when no protection is specified.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 Used by `semantic-format-tag-uml-protection-to-string'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 :type 'string)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 (defun semantic--format-uml-post-colorize (text tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608 "Add color to TEXT created from TAG and PARENT.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 Adds augmentation for `abstract' and `static' entries."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 (if (semantic-tag-abstract-p tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 (setq text (semantic--format-colorize-merge-text text 'abstract)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 (if (semantic-tag-static-p tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 (setq text (semantic--format-colorize-merge-text text 'static)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 text
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (defun semantic-uml-attribute-string (tag &optional parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 "Return a string for TAG, a child of PARENT representing a UML attribute.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 UML attribute strings are things like {abstract} or {leaf}."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 (cond ((semantic-tag-abstract-p tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 "{abstract}")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 ((semantic-tag-leaf-p tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 "{leaf}")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 (defvar semantic-format-tag-protection-image-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 '(("+" . ezimage-unlock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 ("#" . ezimage-key)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 ("-" . ezimage-lock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 "Association of protection strings, and images to use.")
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 (defvar semantic-format-tag-protection-symbol-to-string-assoc-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 '((public . "+")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 (protected . "#")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 (private . "-")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 "Association list of the form (SYMBOL . \"STRING\") for protection symbols.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 This associates a symbol, such as 'public with the st ring \"+\".")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 (define-overloadable-function semantic-format-tag-uml-protection-to-string (protection-symbol color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 "Convert PROTECTION-SYMBOL to a string for UML.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 By default, uses `semantic-format-tag-protection-symbol-to-string-assoc-list'
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 to convert.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 By defaul character returns are:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 public -- +
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 private -- -
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 protected -- #.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 If PROTECTION-SYMBOL is unknown, then the return value is
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 `semantic-uml-no-protection-string'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 COLOR indicates if we should use an image on the text.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 (defun semantic-format-tag-uml-protection-to-string-default (protection-symbol color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 "Convert PROTECTION-SYMBOL to a string for UML.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 Uses `semantic-format-tag-protection-symbol-to-string-assoc-list' to convert.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 If PROTECTION-SYMBOL is unknown, then the return value is
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 `semantic-uml-no-protection-string'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 COLOR indicates if we should use an image on the text."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 (let* ((ezimage-use-images (and semantic-format-use-images-flag color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 (key (assoc protection-symbol
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 semantic-format-tag-protection-symbol-to-string-assoc-list))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (str (or (cdr-safe key) semantic-uml-no-protection-string)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (ezimage-image-over-string
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (copy-sequence str) ; make a copy to keep the original pristine.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 semantic-format-tag-protection-image-alist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 (defsubst semantic-format-tag-uml-protection (tag parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 "Retrieve the protection string for TAG with PARENT.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 Argument COLOR specifies that color should be added to the string as
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 needed."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 (semantic-format-tag-uml-protection-to-string
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (semantic-tag-protection tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (defun semantic--format-tag-uml-type (tag color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 "Format the data type of TAG to a string usable for formatting.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 COLOR indicates if it should be colorized."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 (let ((str (semantic-format-tag-type tag color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (if str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (concat semantic-uml-colon-string str))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (define-overloadable-function semantic-format-tag-uml-abbreviate (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 "Return a UML style abbreviation for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 (defun semantic-format-tag-uml-abbreviate-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 "Return a UML style abbreviation for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 (let* ((name (semantic-format-tag-name tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (type (semantic--format-tag-uml-type tag color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 (protstr (semantic-format-tag-uml-protection tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 (text nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 (setq text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 (concat
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 protstr
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 (if type (concat name type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 (setq text (semantic--format-uml-post-colorize text tag parent)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 text))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 (define-overloadable-function semantic-format-tag-uml-prototype (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 "Return a UML style prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 Optional argument COLOR means highlight the prototype with font-lock colors.")
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 (defun semantic-format-tag-uml-prototype-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 "Return a UML style prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 (let* ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 (cp (semantic-format-tag-name tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715 (type (semantic--format-tag-uml-type tag color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (prot (semantic-format-tag-uml-protection tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717 (argtext
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718 (cond ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 (concat
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--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 #'semantic-format-tag-uml-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725 ")"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727 "{}")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 (text nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 (setq text (concat prot cp argtext type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 (setq text (semantic--format-uml-post-colorize text tag parent)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 (define-overloadable-function semantic-format-tag-uml-concise-prototype (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 "Return a UML style concise prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 Optional argument COLOR means highlight the prototype with font-lock colors.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (defun semantic-format-tag-uml-concise-prototype-default (tag &optional parent color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 "Return a UML style concise prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742 Optional argument PARENT is the parent type if TAG is a detail.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 Optional argument COLOR means highlight the prototype with font-lock colors."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 (let* ((cp (semantic-format-tag-concise-prototype tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 (type (semantic--format-tag-uml-type tag color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746 (prot (semantic-format-tag-uml-protection tag parent color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747 (text nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749 (setq text (concat prot cp type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 (setq text (semantic--format-uml-post-colorize text tag parent)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752 text
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 ;;; Compatibility and aliases
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758 (semantic-alias-obsolete 'semantic-prin1-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 'semantic-format-tag-prin1)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 (semantic-alias-obsolete 'semantic-name-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 'semantic-format-tag-name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 (semantic-alias-obsolete 'semantic-abbreviate-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765 'semantic-format-tag-abbreviate)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 (semantic-alias-obsolete 'semantic-summarize-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 'semantic-format-tag-summarize)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 (semantic-alias-obsolete 'semantic-prototype-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 'semantic-format-tag-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (semantic-alias-obsolete 'semantic-concise-prototype-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774 'semantic-format-tag-concise-prototype)
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 (semantic-alias-obsolete 'semantic-uml-abbreviate-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777 'semantic-format-tag-uml-abbreviate)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 (semantic-alias-obsolete 'semantic-uml-prototype-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 'semantic-format-tag-uml-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782 (semantic-alias-obsolete 'semantic-uml-concise-prototype-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783 'semantic-format-tag-uml-concise-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786 (provide 'semantic/format)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
788 ;;; semantic/format.el ends here