Function: c-full-get-near-cache-entry

c-full-get-near-cache-entry is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-full-get-near-cache-entry HERE)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-full-get-near-cache-entry (here)
  ;; Return a near cache entry which either represents a literal which
  ;; encloses HERE, or is at the highest position before HERE.  The returned
  ;; cache entry is of the form (POSITION STATE END), where STATE has the form
  ;; of a result from `parse-partial-sexp' which is valid at POSITION and END
  ;; is the end of any enclosing literal, or nil.
  (let ((nc-pos-state
	 (or (assq here c-full-lit-near-cache)
	     (let ((nc-list c-full-lit-near-cache)
		   elt (nc-pos 0) cand-pos-state)
	       (catch 'found
		 (while nc-list
		   (setq elt (car nc-list))
		   (when
		       (and (car (cddr elt))
			    (> here (nth 8 (cadr elt)))
			    (< here (car (cddr elt))))
		     (throw 'found elt))
		   (when
		       (and (< (car elt) here)
			    (> (car elt) nc-pos))
		     (setq nc-pos (car elt)
			   cand-pos-state elt))
		   (setq nc-list (cdr nc-list)))
		 cand-pos-state)))))
    ;; Move the found cache entry, if any, to the front of the list.
    (when (and nc-pos-state
	       (not (eq nc-pos-state (car c-full-lit-near-cache))))
      (setq c-full-lit-near-cache
	    (delq nc-pos-state c-full-lit-near-cache))
      (push nc-pos-state c-full-lit-near-cache))
    (copy-tree nc-pos-state)))