X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/9dc5028d4aedbd0a300d1e432d5990581600ef68..a088e67e4a6983ef76c9d8253d08e92b55d0c13f:/glib/gforeign.lisp diff --git a/glib/gforeign.lisp b/glib/gforeign.lisp index 2330195..fe9dd9f 100644 --- a/glib/gforeign.lisp +++ b/glib/gforeign.lisp @@ -15,7 +15,7 @@ ;; License along with this library; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -;; $Id: gforeign.lisp,v 1.11 2001/10/21 16:50:43 espen Exp $ +;; $Id: gforeign.lisp,v 1.14 2002/04/02 14:52:25 espen Exp $ (in-package "GLIB") @@ -346,6 +346,7 @@ (defun %defbinding (foreign-name lisp-name lambda-list (let ((alien-funcall `(alien-funcall ,lisp-name ,@(alien-parameters)))) `(defun ,lisp-name ,lambda-list ,@docs + (declare (optimize (ext:inhibit-warnings 3))) (with-alien ((,lisp-name (function ,(translate-type-spec return-type-spec) @@ -374,7 +375,7 @@ (defun mkbinding (name return-type &rest arg-types) :type (alien::parse-alien-type ftype) :sap-form (system:foreign-symbol-address name)))) (translate-arguments - (mapcar #'intern-return-value-translator arg-types)) + (mapcar #'intern-argument-translator arg-types)) (translate-return-value (intern-return-value-translator return-type)) (cleanup-arguments (mapcar #'intern-cleanup-function arg-types))) @@ -395,19 +396,17 @@ (defun every-type-translateable-p (type-specs) (defun mkbinding-late (name return-type &rest arg-types) (if (every-type-translateable-p (cons return-type arg-types)) (apply #'mkbinding name return-type arg-types) - (let* ((binding - #'(lambda (&rest args) - (cond - ((every-type-translateable-p (cons return-type arg-types)) - (setq binding (apply #'mkbinding name return-type arg-types)) - (apply binding args)) - (t - (dolist (type-spec (cons return-type arg-types)) - (unless (type-translateable-p type-spec) - (error "Can't translate type ~A" type-spec)))))))) + (let ((binding nil)) #'(lambda (&rest args) - (apply binding args))))) - + (cond + (binding (apply binding args)) + ((every-type-translateable-p (cons return-type arg-types)) + (setq binding (apply #'mkbinding name return-type arg-types)) + (apply binding args)) + (t + (dolist (type-spec (cons return-type arg-types)) + (unless (type-translateable-p type-spec) + (error "Can't translate type ~A" type-spec)))))))))