3 ;;;; Copyright (C) 1999 Free Software Foundation, Inc.
5 ;;;; This program is free software; you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation; either version 2, or (at your option)
8 ;;;; any later version.
10 ;;;; This program is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;;; GNU General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with this software; see the file COPYING. If not, write to
17 ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 ;;;; Boston, MA 02111-1307 USA
22 ;;;; This software is a derivative work of other copyrighted softwares; the
23 ;;;; copyright notices of these softwares are placed in the file COPYRIGHTS
25 ;;;; This file is based upon active-slot.stklos from the STk
26 ;;;; distribution by Erick Gallesio <eg@unice.fr>.
29 (define-module (oop goops active-slot)
30 :use-module (oop goops internal))
32 (export <active-class>)
34 (define-class <active-class> (<class>))
36 (define-method compute-get-n-set ((class <active-class>) slot)
37 (if (eq? (slot-definition-allocation slot) #:active)
38 (let* ((index (slot-ref class 'nfields))
41 (env (class-environment class))
42 (before-ref (get-keyword #:before-slot-ref s #f))
43 (after-ref (get-keyword #:after-slot-ref s #f))
44 (before-set! (get-keyword #:before-slot-set! s #f))
45 (after-set! (get-keyword #:after-slot-set! s #f))
46 (unbound (make-unbound)))
47 (slot-set! class 'nfields (+ index 1))
51 (let ((res (%fast-slot-ref o index)))
52 (and after-ref (not (eqv? res unbound)) (after-ref o))
55 (let ((res (%fast-slot-ref o index)))
56 (and after-ref (not (eqv? res unbound)) (after-ref o))
63 (%fast-slot-set! o index v)
64 (and after-set! (after-set! o v))))
66 (%fast-slot-set! o index v)
67 (and after-set! (after-set! o v)))))))