Function: hif-display-macro

hif-display-macro is a byte-compiled function defined in hideif.el.gz.

Signature

(hif-display-macro NAME DEF &optional RESULT)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideif.el.gz
(defun hif-display-macro (name def &optional result)
  (if (and def
           (listp def)
           (eq (car def) 'hif-define-macro))
      (let ((cdef (concat "#define " name))
            (parmlist (cadr def))
            p s etc)
        (setq def (caddr def))
        ;; parmlist
        (when parmlist
          (setq cdef (concat cdef "("))
          (if (setq etc (or (eq (setq p (car parmlist)) 'hif-etc)
                            (and (eq p 'hif-etc-c99) 'c99)))
              (pop parmlist))
          (while (setq p (car parmlist))
            (setq cdef (concat cdef (symbol-name p) (if (cdr parmlist) ","))
                  parmlist (cdr parmlist)))
          (setq cdef (concat cdef
                             (if etc (concat (if (eq etc 'c99) ",") "..."))
                             ")")))
        (setq cdef (concat cdef " "))
        ;; body
        (while def
          (if (listp def)
              (setq s (car def)
                    def (cdr def))
            (setq s def
                  def nil))
          (setq cdef
                (concat cdef
                        (cond
                         ;;((setq tok (car (rassoc s hif-token-alist)))
                         ;; (concat tok (if (eq s 'hif-comma) " ")))
                         ((symbolp s)
                          (concat (hif-stringify s)
                                  (if (eq s 'hif-comma) " ")))
                         ((stringp s)
                          (hif-stringify s))
                         (t ;; (numberp s)
                          (format "%S" s))))))
        (if (and result
                 ;; eg: "#define RECURSIVE_SYMBOL RECURSIVE_SYMBOL"
                 (not (and (listp result)
                           (eq (car result) 'hif-define-macro))))
            (setq cdef (concat cdef
                               (if (integerp result)
                                   (format "\n=> %S (%#x)" result result)
                                 (format "\n=> %S" result)))))
        (message "%s" cdef))
    (message "%S <= `%s'" def name)))