1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

* boot-9.scm (struct-printer): Bugfix: Check the layout of the

vtable and not the one of the struct.
This commit is contained in:
Marius Vollmer 1997-06-06 15:14:55 +00:00
parent 5dade85779
commit 755da2fc99

View file

@ -332,11 +332,12 @@
(define %struct-printer-tag (cons '%struct-printer-tag #f))
(define (struct-printer s)
(and (>= (string-length (struct-layout s))
(* 2 struct-vtable-offset))
(let ((p (struct-ref (struct-vtable s) struct-vtable-offset)))
(and (eq? (car p) %struct-printer-tag)
(cdr p)))))
(let ((vtable (struct-vtable s)))
(and (>= (string-length (struct-layout vtable))
(* 2 struct-vtable-offset))
(let ((p (struct-ref vtable struct-vtable-offset)))
(and (eq? (car p) %struct-printer-tag)
(cdr p))))))
(define (make-struct-printer printer)
(cons %struct-printer-tag printer))