X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/beae657932a8db54ea662b6b48eebb62dd23f98b..7ecf52b3a8b7814e8d3301262e957d49bce61198:/gffi/interface.lisp diff --git a/gffi/interface.lisp b/gffi/interface.lisp index 041935b..6778ea6 100644 --- a/gffi/interface.lisp +++ b/gffi/interface.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: interface.lisp,v 1.1 2006-04-25 20:36:05 espen Exp $ +;; $Id: interface.lisp,v 1.5 2007-04-06 16:06:24 espen Exp $ (in-package "GFFI") @@ -53,17 +53,11 @@ (defun default-alien-fname (lisp-name) (let* ((name (substitute #\_ #\- (string-downcase lisp-name))) - (stripped-name - (cond - ((and - (char= (char name 0) #\%) - (string= "_p" name :start2 (- (length name) 2))) - (subseq name 1 (- (length name) 2))) - ((char= (char name 0) #\%) - (subseq name 1)) - ((string= "_p" name :start2 (- (length name) 2)) - (subseq name 0 (- (length name) 2))) - (name))) + (start (position-if-not #'(lambda (char) (char= char #\%)) name)) + (end (if (string= "_p" name :start2 (- (length name) 2)) + (- (length name) 2) + (length name))) + (stripped-name (subseq name start end)) (prefix (package-prefix *package*))) (if (or (not prefix) (string= prefix "")) stripped-name @@ -172,7 +166,8 @@ (:language :stdc)))) `(funcall (load-time-value - (ffi::foreign-library-function ,cname (ffi::foreign-library :default) + (ffi::foreign-library-function + ,cname (ffi::foreign-library :default) #?(clisp>= 2 40)nil nil (ffi:parse-c-type ',c-function))) ,@fparams))) @@ -233,7 +228,7 @@ (system-area-pointer address)))))) #+clisp (ffi::foreign-library-function name - (ffi::foreign-library :default) + (ffi::foreign-library :default) #?(clisp>= 2 40)nil nil (ffi:parse-c-type c-function))) (return-value-translator (from-alien-function return-type))) (multiple-value-bind (arg-translators cleanup-funcs) @@ -429,7 +424,7 @@ (lookup-method (type-spec) (if (and (symbolp type-spec) (find-class type-spec nil)) (let ((class (find-class type-spec))) - #+clisp + #?(or (sbcl>= 0 9 15) (featurep :clisp)) (unless (class-finalized-p class) (finalize-inheritance class)) (search-method-in-cpl-order @@ -459,7 +454,9 @@ ;; This is to handle unexpandable types whichs doesn't name a ;; class. It may cause infinite loops with illegal ;; call-next-method calls - (unless (and (symbolp type-spec) (find-class type-spec nil)) + (unless (or + (null type-spec) + (and (symbolp type-spec) (find-class type-spec nil))) (search-nodes (get name 'built-in-type-hierarchy))) (when error-p (error "No next type method ~A for type specifier ~A"