r2998: add sbcl support
[uffi.git] / src / strings.lisp
index 5d8094e35c799f47ed2be54099bb7e17e215b789..63847cc3885fa0bcd61c6157a1c946ed604d2e58 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: strings.lisp,v 1.2 2002/10/14 01:51:15 kevin Exp $
+;;;; $Id: strings.lisp,v 1.3 2002/10/14 03:07:41 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -206,7 +206,7 @@ that LW/CMU automatically converts strings from c-calls."
   #+sbcl
   (let ((array-def (gensym)))
     `(let ((,array-def (list 'sb-alien:array 'char ,size)))
-       (eval `(alien:cast (sb-alien:make-alien ,,array-def) 
+       (eval `(sb-alien:cast (sb-alien:make-alien ,,array-def) 
                          ,(if ,unsigned 
                               '(* (sb-alien:unsigned 8))
                             '(* (sb-alien:signed 8)))))))
@@ -237,9 +237,7 @@ that LW/CMU automatically converts strings from c-calls."
 
 ;; Modified from CMUCL's source to handle non-null terminated strings
 #+cmu
-(defun cmucl-naturalize-cstring (sap &key 
-                                          length
-                                          (null-terminated-p t))
+(defun cmucl-naturalize-cstring (sap &key length (null-terminated-p t))
   (declare (type system:system-area-pointer sap))
   (locally
       (declare (optimize (speed 3) (safety 0)))
@@ -262,9 +260,7 @@ that LW/CMU automatically converts strings from c-calls."
       result)))
 
 #+sbcl
-(defun sbcl-naturalize-cstring (sap &key 
-                                          length
-                                          (null-terminated-p t))
+(defun sbcl-naturalize-cstring (sap &key length (null-terminated-p t))
   (declare (type sb-sys:system-area-pointer sap))
   (locally
       (declare (optimize (speed 3) (safety 0)))
@@ -272,7 +268,7 @@ that LW/CMU automatically converts strings from c-calls."
           (when null-terminated-p
             (loop
                 for offset of-type fixnum upfrom 0
-                until (zerop (system:sap-ref-8 sap offset))
+                until (zerop (sb-sys:sap-ref-8 sap offset))
                 finally (return offset)))))
       (if length
          (if (and null-terminated-length
@@ -282,6 +278,6 @@ that LW/CMU automatically converts strings from c-calls."
     (let ((result (make-string length)))
       (sb-kernel:copy-from-system-area sap 0
                                    result (* sb-vm:vector-data-offset
-                                             sb-vm:word-bits)
-                                   (* length sb-vm:byte-bits))
+                                             sb-vm:n-word-bits)
+                                   (* length sb-vm:n-byte-bits))
       result)))