Function: srecode-semantic-handle-:c

srecode-semantic-handle-:c is an autoloaded and byte-compiled function defined in cpp.el.gz.

Signature

(srecode-semantic-handle-:c DICT)

Documentation

Add macros into the dictionary DICT based on the current C file.

Adds the following: FILENAME_SYMBOL - filename converted into a C compat symbol. HEADER - Shown section if in a header file.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/cpp.el.gz
;;; :c ARGUMENT HANDLING
;;
;; When a :c argument is required, fill the dictionary with
;; information about the current C file.
;;
;; Error if not in a C mode.

;;;###autoload
(defun srecode-semantic-handle-:c (dict)
  "Add macros into the dictionary DICT based on the current C file.
Adds the following:
FILENAME_SYMBOL - filename converted into a C compat symbol.
HEADER - Shown section if in a header file."
  ;; A symbol representing
  (let ((fsym (file-name-nondirectory (buffer-file-name)))
	(case-fold-search t))

    ;; Are we in a header file?
    (if (string-match "\\.\\(h\\|hh\\|hpp\\|h\\+\\+\\)$" fsym)
	(srecode-dictionary-show-section dict "HEADER")
      (srecode-dictionary-show-section dict "NOTHEADER"))

    ;; Strip out bad characters
    (setq fsym (replace-regexp-in-string "[^a-zA-Z0-9_]" "_" fsym))
    (srecode-dictionary-set-value dict "FILENAME_SYMBOL" fsym)
    )
  )