Function: cl-struct-setf-expander

cl-struct-setf-expander is a byte-compiled function defined in cl.el.gz.

This function is obsolete since 24.3.

Signature

(cl-struct-setf-expander X NAME ACCESSOR PRED-FORM POS)

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/cl.el.gz
;; Used in the expansion of the old `defstruct'.
(defun cl-struct-setf-expander (x name accessor pred-form pos)
  (declare (obsolete nil "24.3"))
  (let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--")))
    (list (list temp) (list x) (list store)
	  `(progn
             ,@(and pred-form
                    (list `(or ,(cl-subst temp 'cl-x pred-form)
                               (error ,(format
                                        "%s storing a non-%s"
                                        accessor name)))))
             ,(if (eq (car (get name 'cl-struct-type)) 'vector)
                  `(aset ,temp ,pos ,store)
                `(setcar
                  ,(if (<= pos 5)
                       (let ((xx temp))
                         (while (>= (setq pos (1- pos)) 0)
                           (setq xx `(cdr ,xx)))
                         xx)
                     `(nthcdr ,pos ,temp))
                  ,store)))
	  (list accessor temp))))