]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/format.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / format.el
index b13673318d2731915ee7cb3ae775a827ae0b2c90..1184a98951ea29063904edbf2fa0087350a0fcc0 100644 (file)
@@ -1,7 +1,6 @@
 ;;; semantic/format.el --- Routines for formatting tags
 
-;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007,
-;;; 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
@@ -66,20 +65,14 @@ would claim as a parent.
 COLOR indicates that the generated text should be colored using
 `font-lock'.")
 
-(semantic-varalias-obsolete 'semantic-token->text-functions
-                           'semantic-format-tag-functions)
-
 (defvar semantic-format-tag-custom-list
   (append '(radio)
          (mapcar (lambda (f) (list 'const f))
                  semantic-format-tag-functions)
          '(function))
-  "A List used by customizeable variables to choose a tag to text function.
+  "A List used by customizable variables to choose a tag to text function.
 Use this variable in the :type field of a customizable variable.")
 
-(semantic-varalias-obsolete 'semantic-token->text-custom-list
-                           'semantic-format-tag-custom-list)
-
 (defcustom semantic-format-use-images-flag ezimage-use-images
   "Non-nil means semantic format functions use images.
 Images can be used as icons instead of some types of text strings."
@@ -123,17 +116,13 @@ is a symbol representing a face.
 Faces used are generated in `font-lock' for consistency, and will not
 be used unless font lock is a feature.")
 
-(semantic-varalias-obsolete 'semantic-face-alist
-                           'semantic-format-face-alist)
-
-
 \f
 ;;; Coloring Functions
 ;;
 (defun semantic--format-colorize-text (text face-class)
   "Apply onto TEXT a color associated with FACE-CLASS.
-FACE-CLASS is a tag type found in `semantic-face-alist'.  See this variable
-for details on adding new types."
+FACE-CLASS is a tag type found in `semantic-format-face-alist'.
+See that variable for details on adding new types."
   (if (featurep 'font-lock)
       (let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
            (newtext (concat text)))
@@ -141,13 +130,10 @@ for details on adding new types."
        newtext)
     text))
 
-(make-obsolete 'semantic-colorize-text
-              'semantic--format-colorize-text)
-
 (defun semantic--format-colorize-merge-text (precoloredtext face-class)
   "Apply onto PRECOLOREDTEXT a color associated with FACE-CLASS.
-FACE-CLASS is a tag type found in 'semantic-face-alist'.  See this
-variable for details on adding new types."
+FACE-CLASS is a tag type found in `semantic-formatface-alist'.
+See that variable for details on adding new types."
   (let ((face (cdr-safe (assoc face-class semantic-format-face-alist)))
        (newtext (concat precoloredtext))
        )
@@ -305,19 +291,19 @@ local definitions."
   ;; Try and find a trail of parents from PARENT
   (let ((rlist (list parent))
        )
-    ;; IMPLELEMENT ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    ;; IMPLEMENT ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     (reverse rlist)))
 
 (define-overloadable-function semantic-format-tag-canonical-name (tag &optional parent color)
   "Return a canonical name for TAG.
-A canonical name includes the names of any parents or namespaces preceeding
+A canonical name includes the names of any parents or namespaces preceding
 the tag.
 Optional argument PARENT is the parent type if TAG is a detail.
 Optional argument COLOR means highlight the prototype with font-lock colors.")
 
 (defun semantic-format-tag-canonical-name-default (tag &optional parent color)
   "Return a canonical name for TAG.
-A canonical name includes the names of any parents or namespaces preceeding
+A canonical name includes the names of any parents or namespaces preceding
 the tag with colons separating them.
 Optional argument PARENT is the parent type if TAG is a detail.
 Optional argument COLOR means highlight the prototype with font-lock colors."
@@ -381,10 +367,6 @@ This is a simple C like default."
     (setq str (concat prefix name suffix))
     str))
 
-;; Semantic 1.2.x had this misspelling.  Keep it for backwards compatibiity.
-(semantic-alias-obsolete
- 'semantic-summerize-nonterminal 'semantic-format-tag-summarize)
-
 ;;;###autoload
 (define-overloadable-function semantic-format-tag-summarize (tag &optional parent color)
   "Summarize TAG in a reasonable way.
@@ -449,8 +431,9 @@ Optional argument COLOR means highlight the prototype with font-lock colors."
         (doc (semantic-tag-docstring tag buf)))
     (when (and (not doc) (not buf) fname)
       ;; If there is no doc, and no buffer, but we have a filename,
-      ;; lets try again.
-      (setq buf (find-file-noselect fname))
+      ;; let's try again.
+      (save-match-data
+       (setq buf (find-file-noselect fname)))
       (setq doc (semantic-tag-docstring tag buf)))
     (when (not doc)
       (require 'semantic/doc)
@@ -516,7 +499,12 @@ Optional argument COLOR means highlight the prototype with font-lock colors."
                        (setq r (concat r "[]")
                              deref (1- deref)))
                      r)))
-        )
+        (default (when (eq class 'variable)
+                   (let ((defval
+                           (semantic-tag-get-attribute tag :default-value)))
+                     (when (and defval (stringp defval))
+                       (concat "[=" defval "]")))))
+        )
     (if args
        (setq args
              (concat " "
@@ -529,7 +517,8 @@ Optional argument COLOR means highlight the prototype with font-lock colors."
            (if type (concat type " "))
            name
            (or args "")
-           (or array ""))))
+           (or array "")
+           (or default ""))))
 
 ;;;###autoload
 (define-overloadable-function semantic-format-tag-concise-prototype (tag &optional parent color)
@@ -620,7 +609,7 @@ This associates a symbol, such as 'public with the st ring \"+\".")
   "Convert PROTECTION-SYMBOL to a string for UML.
 By default, uses `semantic-format-tag-protection-symbol-to-string-assoc-list'
 to convert.
-By defaul character returns are:
+By default character returns are:
   public    -- +
   private   -- -
   protected -- #.
@@ -727,71 +716,12 @@ Optional argument COLOR means highlight the prototype with font-lock colors."
     (setq text (concat prot cp type))
     (if color
        (setq text (semantic--format-uml-post-colorize text tag parent)))
-    text
-    ))
-
-\f
-;;; Test routines
-;;
-(defun semantic-test-all-format-tag-functions (&optional arg)
-  "Test all outputs from `semantic-format-tag-functions'.
-Output is generated from the function under `point'.
-Optional argument ARG specifies not to use color."
-  (interactive "P")
-  (semantic-fetch-tags)
-  (let* ((tag (semantic-current-tag))
-        (par (semantic-current-tag-parent))
-        (fns semantic-format-tag-functions))
-    (with-output-to-temp-buffer "*format-tag*"
-      (princ "Tag->format function tests:")
-      (while fns
-       (princ "\n")
-       (princ (car fns))
-       (princ ":\n ")
-       (let ((s (funcall (car fns) tag par (not arg))))
-         (save-excursion
-           (set-buffer "*format-tag*")
-           (goto-char (point-max))
-           (insert s)))
-       (setq fns (cdr fns))))
-      ))
-
-\f
-;;; Compatibility and aliases
-;;
-(semantic-alias-obsolete 'semantic-prin1-nonterminal
-                        'semantic-format-tag-prin1)
-
-(semantic-alias-obsolete 'semantic-name-nonterminal
-                        'semantic-format-tag-name)
-
-(semantic-alias-obsolete 'semantic-abbreviate-nonterminal
-                        'semantic-format-tag-abbreviate)
-
-(semantic-alias-obsolete 'semantic-summarize-nonterminal
-                        'semantic-format-tag-summarize)
-
-(semantic-alias-obsolete 'semantic-prototype-nonterminal
-                        'semantic-format-tag-prototype)
-
-(semantic-alias-obsolete 'semantic-concise-prototype-nonterminal
-                        'semantic-format-tag-concise-prototype)
-
-(semantic-alias-obsolete 'semantic-uml-abbreviate-nonterminal
-                        'semantic-format-tag-uml-abbreviate)
-
-(semantic-alias-obsolete 'semantic-uml-prototype-nonterminal
-                        'semantic-format-tag-uml-prototype)
-
-(semantic-alias-obsolete 'semantic-uml-concise-prototype-nonterminal
-                        'semantic-format-tag-uml-concise-prototype)
-
+    text))
 
 (provide 'semantic/format)
 
 ;; Local variables:
 ;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
 ;; generated-autoload-load-name: "semantic/format"
 ;; End: