summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-01-19 17:11:21 +0100
committerAndy Wingo <wingo@pobox.com>2015-01-23 16:16:04 +0100
commit0b4c068d532a372222d890a4f66e2d47f4de651e (patch)
treeae2a48afe4ee3d449c7dadaa2d9459c5216c7770
parent7c49985fac7d8d095c5fcad314b11e7a3c8dbf78 (diff)
downloadguile-0b4c068d532a372222d890a4f66e2d47f4de651e.tar.gz
Update (oop goops save) for <slot> objects
* module/oop/goops/describe.scm (describe): Remove commented code. * module/oop/goops/save.scm (get-set-for-each, access-for-each): Update these hoary routines for the new <slot> universe.
-rw-r--r--module/oop/goops/describe.scm11
-rw-r--r--module/oop/goops/save.scm49
2 files changed, 26 insertions, 34 deletions
diff --git a/module/oop/goops/describe.scm b/module/oop/goops/describe.scm
index 52eb29954..0428b4ba8 100644
--- a/module/oop/goops/describe.scm
+++ b/module/oop/goops/describe.scm
@@ -1,6 +1,6 @@
;;; installed-scm-file
-;;;; Copyright (C) 1998, 1999, 2001, 2006, 2008, 2009 Free Software Foundation, Inc.
+;;;; Copyright (C) 1998, 1999, 2001, 2006, 2008, 2009, 2015 Free Software Foundation, Inc.
;;;; Copyright (C) 1993-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;; This library is free software; you can redistribute it and/or
@@ -138,14 +138,7 @@
(format #t "(No direct method)~%")
(begin
(format #t "Class direct methods are:~%")
- (for-each describe methods))))
-
-; (format #t "~%Field Initializers ~% ")
-; (write (slot-ref x 'initializers)) (newline)
-
-; (format #t "~%Getters and Setters~% ")
-; (write (slot-ref x 'getters-n-setters)) (newline)
-)
+ (for-each describe methods)))))
;;;
;;; Describe for generic functions
diff --git a/module/oop/goops/save.scm b/module/oop/goops/save.scm
index a4b15ad20..20c3b0541 100644
--- a/module/oop/goops/save.scm
+++ b/module/oop/goops/save.scm
@@ -370,33 +370,32 @@
;; Don't export this function! This is all very temporary.
;;
(define (get-set-for-each proc class)
- (for-each (lambda (slotdef g-n-s)
- (let ((g-n-s (cddr g-n-s)))
- (cond ((integer? g-n-s)
- (proc (standard-get g-n-s) (standard-set g-n-s)))
- ((not (memq (slot-definition-allocation slotdef)
- '(#:class #:each-subclass)))
- (proc (car g-n-s) (cadr g-n-s))))))
- (class-slots class)
- (slot-ref class 'getters-n-setters)))
+ (for-each (lambda (slot)
+ (unless (memq (slot-definition-allocation slot)
+ '(#:class #:each-subclass))
+ (let ((ref (slot-definition-slot-ref slot))
+ (set (slot-definition-slot-set! slot))
+ (index (slot-definition-index slot)))
+ (if ref
+ (proc ref set)
+ (proc (standard-get index) (standard-set index))))))
+ (class-slots class)))
(define (access-for-each proc class)
- (for-each (lambda (slotdef g-n-s)
- (let ((g-n-s (cddr g-n-s))
- (a (slot-definition-accessor slotdef)))
- (cond ((integer? g-n-s)
- (proc (slot-definition-name slotdef)
- (and a (generic-function-name a))
- (standard-get g-n-s)
- (standard-set g-n-s)))
- ((not (memq (slot-definition-allocation slotdef)
- '(#:class #:each-subclass)))
- (proc (slot-definition-name slotdef)
- (and a (generic-function-name a))
- (car g-n-s)
- (cadr g-n-s))))))
- (class-slots class)
- (slot-ref class 'getters-n-setters)))
+ (for-each (lambda (slot)
+ (unless (memq (slot-definition-allocation slot)
+ '(#:class #:each-subclass))
+ (let ((name (slot-definition-name slot))
+ (accessor (and=> (slot-definition-accessor slot)
+ generic-function-name))
+ (ref (slot-definition-slot-ref slot))
+ (set (slot-definition-slot-set! slot))
+ (index (slot-definition-index slot)))
+ (if ref
+ (proc name accessor ref set)
+ (proc name accessor
+ (standard-get index) (standard-set index))))))
+ (class-slots class)))
(define-macro (restore class slots . exps)
"(restore CLASS (SLOT-NAME1 ...) EXP1 ...)"