From: Kevin M. Rosenberg Date: Mon, 14 Oct 2002 03:07:41 +0000 (+0000) Subject: r2998: add sbcl support X-Git-Tag: v1.6.1~278 X-Git-Url: http://git.kpe.io/?a=commitdiff_plain;ds=sidebyside;h=7653a03580807774202e699a091a2e8520db5cf8;p=uffi.git r2998: add sbcl support --- diff --git a/debian/changelog b/debian/changelog index 20acc72..32eea3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.0.0-1) unstable; urgency=low + + * Initial SBCL compatibility + + -- Kevin M. Rosenberg Sun, 13 Oct 2002 19:01:31 -0600 + cl-uffi (0.9.2-1) unstable; urgency=high * Add AUTHORS file diff --git a/src/functions.lisp b/src/functions.lisp index 5210f0a..ad8aca4 100644 --- a/src/functions.lisp +++ b/src/functions.lisp @@ -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 diff --git a/src/libraries.lisp b/src/libraries.lisp index eec9045..65b64b3 100644 --- a/src/libraries.lisp +++ b/src/libraries.lisp @@ -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) diff --git a/src/os.lisp b/src/os.lisp index f9cc31f..0002c1b 100644 --- a/src/os.lisp +++ b/src/os.lisp @@ -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 diff --git a/src/package.lisp b/src/package.lisp index dbd851b..1422638 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -73,3 +73,5 @@ ;; OS #:run-shell-command )) + + diff --git a/src/strings.lisp b/src/strings.lisp index 5d8094e..63847cc 100644 --- a/src/strings.lisp +++ b/src/strings.lisp @@ -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))) diff --git a/uffi.asd b/uffi.asd index 7e475ce..1076b82 100644 --- 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 ;;;; @@ -19,11 +19,11 @@ (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 " - :version "0.7.2" + :version "1.0.0" :maintainer "Kevin M. Rosenberg " :licence "Lessor Lisp General Public License" :description "Universal Foreign Function Library for Common Lisp" @@ -42,14 +42,15 @@ (: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*)))