From eda2c9d593b74ce5eedf1265e5e81b03c03ca887 Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Thu, 26 Apr 1990 19:59:37 +0000
Subject: [PATCH] Changed the pointer alien-access expert back to correct
 semantics now that I understand what that are supposed to be.  You cannot
 read them, but writing them with a lisp object causes the ``correct'' sap to
 be written.

---
 code/alieneval.lisp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/code/alieneval.lisp b/code/alieneval.lisp
index b7280f2ff..25d6ecec5 100644
--- a/code/alieneval.lisp
+++ b/code/alieneval.lisp
@@ -1212,8 +1212,17 @@ don't know that it is supposed to be used for.  I suspect it is a PERQ crock.
 	      (size :constant 1)
     (declare (ignore size))
     (if (eq kind :read)
-	`(sap-ref-sap ,sap ,offset)
-	`(setf (sap-ref-sap ,sap ,offset) ,value))))
+	`(error "Cannot reference pointer aliens")
+	(let ((n-value (gensym)))
+	  `(setf (sap-ref-sap ,sap ,offset)
+		 (let ((,n-value ,value))
+		   (etypecase ,n-value
+		     (null (int-sap 0))
+		     (system-area-pointer ,n-value)
+		     ((or simple-string
+			  simple-bit-vector
+			  (simple-array unsigned-byte (*)))
+		      (%primitive c::vector-sap ,n-value)))))))))
 
 
 ;;;; Enumeration Alien access:
-- 
GitLab