annotate lisp/cedet/semantic/format.el @ 104447:273e528a9f9b

* emacs-lisp/autoload.el (generated-autoload-load-name): New var. (autoload-generate-file-autoloads): Use it. (make-autoload): Handle define-overloadable-function. * emacs-lisp/lisp-mode.el (define-overloadable-function): Add doc-string-elt property for define-overloadable-function. lisp/cedet/semantic/analyze.el: Add generated-autoload-load-name var. lisp/cedet/semantic/ctxt.el: Add generated-autoload-load-name var. lisp/cedet/semantic/db.el: Add generated-autoload-load-name var. lisp/cedet/semantic/db-file.el: Add generated-autoload-load-name var. lisp/cedet/semantic/db-mode.el: Add generated-autoload-load-name var. lisp/cedet/semantic/db-typecache.el: Add generated-autoload-load-name var. lisp/cedet/semantic/doc.el: Add generated-autoload-load-name var. lisp/cedet/semantic/find.el: Add generated-autoload-load-name var. lisp/cedet/semantic/format.el: Add generated-autoload-load-name var. lisp/cedet/semantic/lex.el: Add generated-autoload-load-name var. lisp/cedet/semantic/sb.el: Require semantic/format. lisp/cedet/semantic/sort.el: Add generated-autoload-load-name var. lisp/cedet/semantic/tag.el: Add generated-autoload-load-name var. lisp/cedet/semantic/tag-file.el: Add generated-autoload-load-name var. lisp/cedet/semantic/tag-ls.el: Add generated-autoload-load-name var.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 05 Sep 2009 01:00:36 +0000
parents df08b7ab0ba0
children 6ccad1511df1
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)
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
73
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (defvar semantic-format-tag-custom-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 (append '(radio)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 (mapcar (lambda (f) (list 'const f))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 semantic-format-tag-functions)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 '(function))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 "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
80 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
81
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (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
83 'semantic-format-tag-custom-list)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (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
86 "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
87 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
88 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 :type 'boolean)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 (defvar semantic-function-argument-separator ","
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 "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
93 (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
94
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 (defvar semantic-format-parent-separator "::"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 "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
97 (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
98
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
99 ;;;###autoload
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
100 (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
101 "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
102 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
103 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
104 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
105
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
106 ;;;###autoload
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
107 (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
108 "Return a prototype for TAG.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
109 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
110 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
111 tools.
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
112 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
113 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
114
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
115
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (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
117 "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
118 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
119 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
120 (interactive "P")
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
121 (require 'semantic/find)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (semantic-fetch-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (let* ((tag (semantic-current-tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (par (semantic-current-tag-parent))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (fns semantic-format-tag-functions))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (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
127 (princ "Tag->format function tests:")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (while fns
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (princ "\n")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (princ (car fns))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (princ ":\n ")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (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
133 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (set-buffer "*format-tag*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (goto-char (point-max))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 (insert s)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (setq fns (cdr fns))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (defvar semantic-format-face-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 `( (function . font-lock-function-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (variable . font-lock-variable-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (type . font-lock-type-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 ;; These are different between Emacsen.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (include . ,(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 (package . ,(if (featurep 'xemacs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 'font-lock-preprocessor-face
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 'font-lock-constant-face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 ;; 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
152 (label . font-lock-string-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (comment . font-lock-comment-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (keyword . font-lock-keyword-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (abstract . italic)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (static . underline)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (documentation . font-lock-doc-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 "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
160 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
161 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
162 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
163 ( SYMBOL . FACE )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 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
165 is a symbol representing a face.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 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
167 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
168
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (semantic-varalias-obsolete 'semantic-face-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 'semantic-format-face-alist)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 ;;; Coloring Functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (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
177 "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
178 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
179 for details on adding new types."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (if (featurep 'font-lock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (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
182 (newtext (concat text)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (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
184 newtext)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 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 (make-obsolete 'semantic-colorize-text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 'semantic--format-colorize-text)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (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
191 "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
192 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
193 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
194 (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
195 (newtext (concat precoloredtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (if (featurep 'xemacs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (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
199 (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
200 (lambda (current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (let ((cf
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 (cond ((facep current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (list current-face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 ((listp current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 current-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (t nil)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (nf
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (cond ((facep face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (list face))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 ((listp face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (t nil))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (append cf nf)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 newtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 newtext))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;;; Function Arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (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
220 "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
221 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
222 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
223 (let ((out nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (while args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (push (if (and formatter
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (semantic-tag-p (car args))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (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
228 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (funcall formatter (car args) nil color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (semantic-format-tag-name-from-anything
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (car args) nil color 'variable))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (setq args (cdr args)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (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
235 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 ;;; Data Type
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (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
239 "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
240 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
241
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (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
243 "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
244 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
245 (let* ((type (semantic-tag-type tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 (out (cond ((semantic-tag-p type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 (let* ((typetype (semantic-tag-type type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (name (semantic-tag-name type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (str (if typetype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (concat typetype " " name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (semantic--format-colorize-text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 str)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 ((and (listp type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (stringp (car type)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (car type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 ((stringp type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (t nil))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (if (and color out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (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
265 out)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 ))
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 ;;; Abstract formatting functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (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
272 "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
273 PARENT and COLOR are ignored."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (format "%S" tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (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
277 parent color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 colorhint)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 "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
280 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
281 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
282 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
283 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
284 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
285 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
286 (cond ((stringp anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (semantic--format-colorize-text anything colorhint))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 ((semantic-tag-p anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (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
290 ;; 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
291 ;; 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
292 ;; 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
293 ;; 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
294 (if (or (null ans) (string= ans ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 (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
296 ans))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ((and (listp anything)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (stringp (car anything)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (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
300
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 (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
302 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 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
304 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
305 (let ((name (semantic-tag-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (destructor
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (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
308 (semantic-tag-function-destructor-p tag))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (when destructor
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (setq name (concat "~" name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (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
313 name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
315 (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
316
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 (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
318 "Under Consideration.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 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
321 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
322 determine PARENT is made.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 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
324 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
325 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
326 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
327 local definitions."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 ;; First, validate the PARENT argument.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (unless parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 ;; 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
331 ;; 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
332 (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
333 (save-excursion
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
334 (require 'semantic/tag-file)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (semantic-go-to-tag tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 (semantic-current-tag-parent)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 (when (stringp parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (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
339 parent (current-buffer))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 ;; 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
341 (let ((rlist (list parent))
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 ;; IMPLELEMENT ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (reverse rlist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 (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
347 "Return a canonical name for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 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
349 the tag.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 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
351 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
352
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (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
354 "Return a canonical name for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 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
356 the tag with colons separating them.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 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
358 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
359 (let ((parent-input-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (if (and parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (semantic-tag-p parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (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
363 (concat
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 ;; 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
365 ;; Just a guess though.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (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
367 ;; 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
368 semantic-format-parent-separator)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (tag-parent-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 (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
372 (semantic-tag-function-parent tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (concat (semantic-tag-function-parent tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 semantic-format-parent-separator))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 ""))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 (concat parent-input-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 tag-parent-str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (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
380 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 (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
383 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 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
385 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
386 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
387 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
388
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 (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
390 "Return an abbreviated string describing TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 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
392 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
393 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
394 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
395 ;; Do lots of complex stuff here.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (let ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (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
398 (suffix "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (prefix "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 str)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (cond ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (setq suffix "()"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ((eq class 'include)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (setq suffix "<>"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 ((eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (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
407 "=" "")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 ((eq class 'label)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (setq suffix ":"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 ((eq class 'code)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (setq prefix "{"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 suffix "}"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (setq suffix "{}"))
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 (setq str (concat prefix name suffix))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 str))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 ;; 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
420 (semantic-alias-obsolete
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 '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
422
104446
df08b7ab0ba0 lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
423 ;;;###autoload
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 (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
425 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 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
427 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
428
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (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
430 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 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
432 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
433 (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
434 (names (if parent
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 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
436 semantic-symbol->name-assoc-list))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (tsymb (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (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
439 (symbol-name tsymb)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (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
442 (concat label ": " proto)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (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
445 "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
446 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
447 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
448
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (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
450 "Summarize TAG in a reasonable way.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 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
452 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
453 (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
454 (file (semantic-tag-file-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 ;; Nothing for tag? Try parent.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 (when (and (not file) (and parent))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (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
459 ;; 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
460 ;; same as the current buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (if (or (not file)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (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
463 proto
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 (setq file (file-name-nondirectory file))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (when color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 (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
467 (concat file ": " proto))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 (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
470 "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
471 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
472 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
473
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
474 (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
475
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 (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
477 "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
478 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
479 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
480
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 (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
482 (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
483 (buf (or (semantic-tag-buffer tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 (when parent (semantic-tag-buffer parent))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (doc (semantic-tag-docstring tag buf)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 (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
487 ;; 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
488 ;; lets try again.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (setq buf (find-file-noselect fname))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 (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
491 (when (not doc)
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
492 (require 'semantic/doc)
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 (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
494 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 (setq doc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (if (not doc)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 ;; No doc, use summarize.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 (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
499 ;; 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
500 (if (string-match "$" doc)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (substring doc 0 (match-beginning 0))
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 (when color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (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
506 doc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 ;;; Prototype generation
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 (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
512 "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
513 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
514 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
515 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
516 (let* ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (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
518 (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
519 (semantic-format-tag-type tag color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 (args (if (member class '(function type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 (semantic--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (if (eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (list "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 ;;(semantic-tag-type-members tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 #'semantic-format-tag-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 color)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 (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
530 (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
531 (mods (append
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 (if const '("const") nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 (cond ((stringp tm) (list tm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 ((consp tm) tm)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 (t nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 (array (if (eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (let ((deref
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 (semantic-tag-get-attribute
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 tag :dereference))
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 (while (and deref (/= deref 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 (setq r (concat r "[]")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 deref (1- deref)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 r)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 (if args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 (setq args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 (concat " "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 (if (eq class 'type) "{" "(")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 args
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 (if (eq class 'type) "}" ")"))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 (when mods
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 (setq mods (concat (mapconcat 'identity mods " ") " ")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 (concat (or mods "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 (if type (concat type " "))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (or args "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (or array ""))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
561 ;;;###autoload
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 (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
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 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
565 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
566
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (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
568 "Return a concise prototype for TAG.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 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
570 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
571 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
572 (let ((class (semantic-tag-class tag)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 (cond
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 (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
576 ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 (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
578 " ("
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 (semantic--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 'semantic-format-tag-concise-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 color)
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 ((eq class 'variable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (let* ((deref (semantic-tag-get-attribute
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 tag :dereference))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (array "")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 (while (and deref (/= deref 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 (setq array (concat array "[]")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 deref (1- deref)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (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
593 array)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 (t
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (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
596
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 ;;; UML display styles
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (defcustom semantic-uml-colon-string " : "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 "*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
601 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
602 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
603 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 :type 'string)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 (defcustom semantic-uml-no-protection-string ""
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 "*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
608 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
609 :group 'semantic
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 :type 'string)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 (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
613 "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
614 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
615 (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
616 (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
617 (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
618 (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
619 text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 (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
623 "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
624 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
625 (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
626 "{abstract}")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 ((semantic-tag-leaf-p tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 "{leaf}")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 (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
632 '(("+" . ezimage-unlock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 ("#" . ezimage-key)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 ("-" . ezimage-lock)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 "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
637
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 (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
639 '((public . "+")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 (protected . "#")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 (private . "-")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 "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
644 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
645
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 (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
647 "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
648 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
649 to convert.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 By defaul character returns are:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 public -- +
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 private -- -
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 protected -- #.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 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
655 `semantic-uml-no-protection-string'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 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
657
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 (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
659 "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
660 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
661 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
662 `semantic-uml-no-protection-string'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 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
664 (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
665 (key (assoc protection-symbol
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 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
667 (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
668 (ezimage-image-over-string
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (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
670 semantic-format-tag-protection-image-alist)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (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
673 "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
674 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
675 needed."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (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
677 (semantic-tag-protection tag parent)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 color))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (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
681 "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
682 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
683 (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
684 (if str
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (concat semantic-uml-colon-string str))))
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 (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
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (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
693 "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
694 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
695 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
696 (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
697 (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
698 (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
699 (text nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (setq text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 (concat
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 protstr
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 (if type (concat name type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 name)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 (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
707 text))
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 (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
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 (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
715 "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
716 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
717 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
718 (let* ((class (semantic-tag-class tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 (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
720 (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
721 (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
722 (argtext
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 (cond ((eq class 'function)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (concat
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 (semantic--format-tag-arguments
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727 (semantic-tag-function-arguments tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 #'semantic-format-tag-uml-prototype
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 color)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 ")"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 ((eq class 'type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 "{}")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 (text nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (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
735 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (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
737 text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (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
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
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 (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
746 "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
747 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
748 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
749 (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
750 (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
751 (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
752 (text nil)
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 (setq text (concat prot cp type))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 (if color
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 (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
757 text
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 ;;; Compatibility and aliases
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 (semantic-alias-obsolete 'semantic-prin1-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 'semantic-format-tag-prin1)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766 (semantic-alias-obsolete 'semantic-name-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 'semantic-format-tag-name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 (semantic-alias-obsolete 'semantic-abbreviate-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 'semantic-format-tag-abbreviate)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 (semantic-alias-obsolete 'semantic-summarize-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 'semantic-format-tag-summarize)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775 (semantic-alias-obsolete 'semantic-prototype-nonterminal
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776 'semantic-format-tag-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778 (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
779 'semantic-format-tag-concise-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 (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
782 'semantic-format-tag-uml-abbreviate)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784 (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
785 'semantic-format-tag-uml-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787 (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
788 'semantic-format-tag-uml-concise-prototype)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791 (provide 'semantic/format)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
793 ;; Local variables:
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
794 ;; generated-autoload-file: "loaddefs.el"
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
795 ;; generated-autoload-feature: semantic/loaddefs
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104446
diff changeset
796 ;; generated-autoload-load-name: "semantic/format"
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
797 ;; End:
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
798
104442
b22b44e953cb cedet/semantic/chart.el: Don't require semantic/find.
Chong Yidong <cyd@stupidchicken.com>
parents: 104417
diff changeset
799 ;;; semantic/format.el ends here