Function: semantic-expand-c-tag

semantic-expand-c-tag is a byte-compiled function defined in c.el.gz.

Signature

(semantic-expand-c-tag TAG)

Documentation

Expand TAG into a list of equivalent tags, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(defun semantic-expand-c-tag (tag)
  "Expand TAG into a list of equivalent tags, or nil."
  (let ((return-list nil)
	)
    ;; Expand an EXTERN C first.
    (when (eq (semantic-tag-class tag) 'extern)
      (setq return-list (semantic-expand-c-extern-C tag))
      ;; The members will be expanded in the next iteration. The
      ;; 'extern' tag itself isn't needed anymore.
      (setq tag nil))

    ;; Check if we have a complex type
    (when (or (semantic-tag-of-class-p tag 'function)
	      (semantic-tag-of-class-p tag 'variable))
      (setq tag (semantic-expand-c-complex-type tag))
      ;; Extract new basetag
      (setq return-list (car tag))
      (setq tag (cdr tag)))

    ;; Name of the tag is a list, so expand it.  Tag lists occur
    ;; for variables like this: int var1, var2, var3;
    ;;
    ;; This will expand that to 3 tags that happen to share the
    ;; same overlay information.
    (if (consp (semantic-tag-name tag))
	(let ((rl (semantic-expand-c-tag-namelist tag)))
	  (cond
	   ;; If this returns nothing, then return nil overall
	   ;; because that will restore the old TAG input.
	   ((not rl) (setq return-list nil))
	   ;; If we have a return, append it to the existing list
	   ;; of returns.
	   ((consp rl)
	    (setq return-list (append rl return-list)))
	   ))
      ;; If we didn't have a list, but the return-list is non-empty,
      ;; that means we still need to take our existing tag, and glom
      ;; it onto our extracted type.
      (if (and tag (consp return-list))
	  (setq return-list (cons tag return-list)))
      )

    ;; Default, don't change the tag means returning nil.
    return-list))