Changeset 4155
- Timestamp:
- 10/01/03 01:27:56 (19 years ago)
- Location:
- trunk/j/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/defstruct.lisp
r4142 r4155 2 2 ;;; 3 3 ;;; Copyright (C) 2003 Peter Graves 4 ;;; $Id: defstruct.lisp,v 1.2 2 2003-09-30 09:57:33piso Exp $4 ;;; $Id: defstruct.lisp,v 1.23 2003-10-01 01:27:56 piso Exp $ 5 5 ;;; 6 6 ;;; This program is free software; you can redistribute it and/or … … 68 68 (setf-expander (gensym))) 69 69 `((setf (symbol-function ',accessor) (get-slot-accessor ,index)) 70 (%put ',accessor *setf-expander*(get-slot-mutator ,index)))))70 (%put ',accessor 'setf-inverse (get-slot-mutator ,index))))) 71 71 72 72 (defun define-access-functions (slots) -
trunk/j/src/org/armedbear/lisp/setf.lisp
r4065 r4155 2 2 ;;; 3 3 ;;; Copyright (C) 2003 Peter Graves 4 ;;; $Id: setf.lisp,v 1.2 6 2003-09-26 00:44:30 piso Exp $4 ;;; $Id: setf.lisp,v 1.27 2003-10-01 01:27:20 piso Exp $ 5 5 ;;; 6 6 ;;; This program is free software; you can redistribute it and/or … … 19 19 20 20 (in-package "SYSTEM") 21 22 (defconstant *setf-expander* (make-symbol "SETF-EXPANDER"))23 21 24 22 (defun get-setf-expansion (form &optional environment) … … 27 25 (values nil nil (list new-var) 28 26 `(setq ,form ,new-var) form))) 29 ((get (car form) *setf-expander*)27 ((get (car form) 'setf-inverse) 30 28 (let ((vars (mapcar #'(lambda (x) (gensym)) (cdr form))) 31 29 (store (gensym))) … … 33 31 (cdr form) 34 32 (list store) 35 `(,(get (car form) *setf-expander*)33 `(,(get (car form) 'setf-inverse) 36 34 ,@vars ,store) 37 35 (cons (car form) vars)))) … … 76 74 (when (macro-function (car place)) 77 75 (setq place (macroexpand place))) 78 (let (( expander (get (car place) *setf-expander*)))79 (cond ((null expander)76 (let ((inverse (get (car place) 'setf-inverse))) 77 (cond ((null inverse) 80 78 (error "no SETF expansion for ~A" place)) 81 ((symbolp expander)82 `(, expander,@(cdr place) ,value))83 ((functionp expander)84 `(funcall , expander,@(cdr place) ,value))79 ((symbolp inverse) 80 `(,inverse ,@(cdr place) ,value)) 81 ((functionp inverse) 82 `(funcall ,inverse ,@(cdr place) ,value)) 85 83 (t 86 84 (error "SETF: unhandled case"))))) … … 103 101 (symbol-function name)) 104 102 ((and (consp name) (eq (car name) 'setf)) 105 (or (get *setf-expander*(cadr name)) (error 'undefined-function)))103 (or (get 'setf-inverse (cadr name)) (error 'undefined-function))) 106 104 (t (error 'type-error)))) 107 105 … … 110 108 (fset name function)) 111 109 ((and (consp name) (eq (car name) 'setf)) 112 (%put (cadr name) *setf-expander*function))110 (%put (cadr name) 'setf-inverse function)) 113 111 (t (error 'type-error)))) 114 112 … … 129 127 130 128 (defmacro defsetf (access-function update-function) 131 `(%put ',access-function *setf-expander*',update-function))129 `(%put ',access-function 'setf-inverse ',update-function)) 132 130 133 131 (defun %set-caar (x v) (%rplaca (car x) v))
Note: See TracChangeset
for help on using the changeset viewer.