Changeset 3594


Ignore:
Timestamp:
09/07/03 16:42:36 (19 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/defstruct.lisp

    r2964 r3594  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: defstruct.lisp,v 1.16 2003-07-16 18:17:22 piso Exp $
     4;;; $Id: defstruct.lisp,v 1.17 2003-09-07 16:42:36 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    4343        (typep object ',*ds-name*)))))
    4444
     45(defmacro get-accessor (slot)
     46  (case slot
     47    (0 #'%structure-ref-0)
     48    (1 #'%structure-ref-1)
     49    (2 #'%structure-ref-2)
     50    (t
     51     `(lambda (instance) (%structure-ref instance ,slot)))))
     52
    4553(defun define-access-function (slot-name index)
    4654  (let ((accessor
     
    4957             slot-name))
    5058        (setf-expander (gensym)))
    51     `((defun ,accessor (instance)
    52         (%structure-ref instance ,index))
     59    `((setf (symbol-function ',accessor) (get-accessor ,index))
    5360      (defun ,setf-expander (instance new-value)
    5461        (%structure-set instance ,index new-value))
Note: See TracChangeset for help on using the changeset viewer.