Function: c-calc-offset

c-calc-offset is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-calc-offset LANGELEM)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-calc-offset (langelem)
  ;; Get offset from LANGELEM which is a list beginning with the
  ;; syntactic symbol and followed by any analysis data it provides.
  ;; That data may be zero or more elements, but if at least one is
  ;; given then the first is the anchor position (or nil).  The symbol
  ;; is matched against `c-offsets-alist' and the offset calculated
  ;; from that is returned.
  ;;
  ;; This function might do hidden buffer changes.
  (let* ((symbol (c-langelem-sym langelem))
	 (match (assq symbol c-offsets-alist))
	 (offset (cdr-safe match)))
    (if match
	(setq offset (c-evaluate-offset offset langelem symbol))
      (if c-strict-syntax-p
	  (c-benign-error "No offset found for syntactic symbol %s" symbol))
      (setq offset 0))
    (cond
     ((or (vectorp offset) (numberp offset))
      offset)
     ((and (symbolp offset) (symbol-value offset)))
     (t 0))))