ffi: avoid 9.1's expansion of define-print-method
authorMatt Birkholz <matt@birchwood-abbey.net>
Tue, 3 Jul 2018 13:58:08 +0000 (08:58 -0500)
committerMatt Birkholz <matt@birchwood-abbey.net>
Tue, 3 Jul 2018 13:58:08 +0000 (08:58 -0500)
src/runtime/ffi.scm

index 3be4c1d32ea627ea87516ecf1851afe9035d2263..eb3b671cbf2d6bf70c881563103269805d2baebc 100644 (file)
@@ -35,7 +35,15 @@ USA.
 (define-structure (alien (constructor %make-alien)
                         (conc-name %alien/)
                         (copier copy-alien)
-                        (predicate alien?))
+                        (predicate alien?)
+                        (print-procedure
+                         (bracketed-print-method 'alien
+                          (lambda (alien port)
+                            (write-char #\space port)
+                            (write (%alien/ctype alien) port)
+                            (write-string " 0x" port)
+                            (write-string (alien/address-string alien)
+                                          port)))))
   ;; Two fixnums.
   (high-bits 0) (low-bits 0)
   ;; A symbol or list.
@@ -45,15 +53,6 @@ USA.
 ;; two digits representing a larger number, then RADIX is their base.
 (define %radix)
 
-(define-print-method alien?
-  (bracketed-print-method
-   'alien
-   (lambda (alien port)
-     (write-char #\space port)
-     (write (%alien/ctype alien) port)
-     (write-string " 0x" port)
-     (write-string (alien/address-string alien) port))))
-
 (define-integrable alien/ctype %alien/ctype)
 
 (define-integrable set-alien/ctype! set-%alien/ctype!)