r2998: add sbcl support
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 14 Oct 2002 03:07:41 +0000 (03:07 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 14 Oct 2002 03:07:41 +0000 (03:07 +0000)
debian/changelog
src/functions.lisp
src/libraries.lisp
src/os.lisp
src/package.lisp
src/strings.lisp
uffi.asd

index 20acc7274381dce4988e995d9d0de7a55c797cc6..32eea3effd4c56e8f459c731bd42f790bac95268 100644 (file)
@@ -1,3 +1,9 @@
+cl-uffi (1.0.0-1) unstable; urgency=low
+
+  * Initial SBCL compatibility
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sun, 13 Oct 2002 19:01:31 -0600
+
 cl-uffi (0.9.2-1) unstable; urgency=high
 
   * Add AUTHORS file
index 5210f0a22a2ec41a8e51839ee85b9fff8a19a212..ad8aca4382a2ff8b7091b9606b63a83bc931789f 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: functions.lisp,v 1.3 2002/10/14 01:51:15 kevin Exp $
+;;;; $Id: functions.lisp,v 1.4 2002/10/14 03:07:41 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -85,7 +85,7 @@
         ,result-type
        ,@function-args)
     #+sbcl
-    `(sb-alien:def-alien-routine (,foreign-name ,lisp-name)
+    `(sb-alien:define-alien-routine (,foreign-name ,lisp-name)
         ,result-type
        ,@function-args)
     #+lispworks
index eec904597c8e56daa7ed7cff3c88758b33145ab9..65b64b34e434b1d9523377c24d1590cdd56c3b1c 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: libraries.lisp,v 1.2 2002/10/14 01:51:15 kevin Exp $
+;;;; $Id: libraries.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
 ;;;;
@@ -84,27 +84,26 @@ library type if type is not specified."
             (find filename *loaded-libraries* :test #'string-equal))
        t ;; return T, but don't reload library
       (progn
-       (when
-           #+cmu
-         (let ((type (pathname-type (parse-namestring filename))))
-           (if (equal type "so")
-               (sys::load-object-file filename)
-             (alien:load-foreign filename 
-                                 :libraries
-                                 (convert-supporting-libraries-to-string
-                                  supporting-libraries))))
-         #+sbcl
-         (sb-alien:load-foreign filename 
-                                :libraries
+       #+cmu
+       (let ((type (pathname-type (parse-namestring filename))))
+         (if (equal type "so")
+             (sys::load-object-file filename)
+           (alien:load-foreign filename 
+                               :libraries
+                               (convert-supporting-libraries-to-string
+                                supporting-libraries))))
+       #+sbcl
+       (sb-alien:load-foreign filename 
+                              :libraries
                                 (convert-supporting-libraries-to-string
                                  supporting-libraries))
-         #+lispworks (fli:register-module module :real-name filename)
-         #+allegro (load filename)
-         #+openmcl (ccl:open-shared-library filename)
-         #+(and mcl (not openmcl)) (ccl:add-to-shared-library-search-path filename t)
-              
-         (push filename *loaded-libraries*)
-         t)))))
+       #+lispworks (fli:register-module module :real-name filename)
+       #+allegro (load filename)
+       #+openmcl (ccl:open-shared-library filename)
+       #+(and mcl (not openmcl)) (ccl:add-to-shared-library-search-path filename t)
+       
+       (push filename *loaded-libraries*)
+       t))))
 
 (defun convert-supporting-libraries-to-string (libs)
   (let (lib-load-list)
index f9cc31f0a31dea5ffe6a3180440500374f519370..0002c1b5b96d6c05ff44331e1c1425b562dd7394 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Sep 2002 
 ;;;;
-;;;; $Id: os.lisp,v 1.1 2002/10/14 01:51:15 kevin Exp $
+;;;; $Id: os.lisp,v 1.2 2002/10/14 03:07:41 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg.
 ;;;; Much of this code was taken from other open source project and copyright
@@ -34,14 +34,14 @@ output to *trace-output*.  Returns the shell's exit code."
     (sb-impl::process-exit-code
      (sb-ext:run-program  
       "/bin/sh"
-      (list  "-c" command)
+      (list "-c" command)
       :input nil :output *trace-output*))
     
     #+(or cmu scl)
     (ext:process-exit-code
      (ext:run-program  
       "/bin/sh"
-      (list  "-c" command)
+      (list "-c" command)
       :input nil :output *trace-output*))
 
     #+allegro
index dbd851bbf11653404c1bd8ff4084cf528c221a45..14226383da860ad8e0046d99bcb75122cbacadf5 100644 (file)
@@ -73,3 +73,5 @@
    ;; OS
    #:run-shell-command
    ))
+
+
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)))
index 7e475ce81f593c39d542cb4c9a74c9f89452ed9f..1076b827897557e0e86de44f6ec1d6e8d156f8dc 100644 (file)
--- a/uffi.asd
+++ b/uffi.asd
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Aug 2002
 ;;;;
-;;;; $Id: uffi.asd,v 1.18 2002/10/01 17:05:29 kevin Exp $
+;;;; $Id: uffi.asd,v 1.19 2002/10/14 03:07:41 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
 (in-package :asdf)
 
-#+(or allegro lispworks cmu mcl cormanlisp)
+#+(or allegro lispworks cmu mcl cormanlisp sbcl)
 (defsystem uffi
   :name "cl-uffi"
   :author "Kevin M. Rosenberg <kmr@debian.org>"
-  :version "0.7.2"
+  :version "1.0.0"
   :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
   :licence "Lessor Lisp General Public License"
   :description "Universal Foreign Function Library for Common Lisp"
             (:file "objects" :depends-on ("primitives"))
             (:file "aggregates" :depends-on ("primitives"))
             (:file "functions" :depends-on ("primitives"))
-            (:file "libraries" :depends-on ("package"))))
+            (:file "libraries" :depends-on ("package"))
+            (:file "os" :depends-on ("package"))))
      #+cormanlisp
      (:module :src-corman
              :components
              ((:file "uffi-corman")))
      ))
 
-#+(or allegro lispworks cmu mcl cormanlisp)
+#+(or allegro lispworks cmu mcl cormanlisp sbcl)
 (when (ignore-errors (find-class 'load-compiled-op))
   (defmethod perform :after ((op load-compiled-op) (c (eql (find-system :uffi))))
     (pushnew :uffi cl:*features*)))