Function: semantic-c-convert-spp-value-to-hideif-value

semantic-c-convert-spp-value-to-hideif-value is a byte-compiled function defined in c.el.gz.

Signature

(semantic-c-convert-spp-value-to-hideif-value SYMBOL MACROVALUE)

Documentation

Convert an spp macro SYMBOL MACROVALUE, to something that hideif can use.

Take the first interesting thing and convert it.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
;;; HIDEIF USAGE:
;; NOTE: All hideif using code was contributed by Brian Carlson as
;;       copies from hideif plus modifications and additions.
;;       Eric then converted things to use hideif functions directly,
;;       deleting most of that code, and added the advice.

;;; SPP SYM EVAL
;;
;; Convert SPP symbols into values usable by hideif.
;;
;; @TODO - can these conversion fcns be a part of semantic-lex-spp.el?
;;       -- TRY semantic-lex-spp-one-token-to-txt
(defun semantic-c-convert-spp-value-to-hideif-value (symbol macrovalue)
  "Convert an spp macro SYMBOL MACROVALUE, to something that hideif can use.
Take the first interesting thing and convert it."
  ;; Just warn for complex macros.
  (when (> (length macrovalue) 1)
    (semantic-push-parser-warning
     (format "Complex macro value (%s) may be improperly evaluated. "
	     symbol) 0 0))

  (let* ((lextoken (car macrovalue))
	 (key (semantic-lex-token-class lextoken))
	 (value (semantic-lex-token-text lextoken)))
    (cond
     ((eq key 'number) (string-to-number value))
     ((eq key 'symbol) (semantic-c-evaluate-symbol-for-hideif value))
     ((eq key 'string)
      (if (string-match "^[0-9]+L?$" value)
	  ;; If it matches a number expression, then
	  ;; convert to a number.
	  (string-to-number value)
	value))
     (t (semantic-push-parser-warning
	 (format "Unknown macro value. Token class = %s value = %s. " key value)
	 0 0)
      nil)
     )))