annotate lisp/cedet/semantic/format.el @ 104486:1ca7a97e0322

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