diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-13 13:59:04 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-13 13:59:04 +0200 |
commit | c31e45dda43e1bf10e66a724cb90d51cd6cfaa26 (patch) | |
tree | 407813141cf00e4a505c6b30afbe14c47fe52797 /Lisp/method-invocation.lisp | |
parent | c5fce012e0a31684eb96ee8770c6b4fb229d3e60 (diff) |
Add a SELECTOR function and use coerced selectors in Objective C code rather than strings.
darcs-hash:d10f9eafc3b21bfcfc027a263e8cee007155b89c
Diffstat (limited to 'Lisp/method-invocation.lisp')
-rw-r--r-- | Lisp/method-invocation.lisp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index 95784fa..17c7cf3 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -131,23 +131,34 @@ Returns: *result* --- the return value of the method invocation. (if (typep lisp-value 'condition) (cerror "Return NIL from OBJCL-INVOKE-METHOD." lisp-value) lisp-value)))) - (let* ((objc-args (mapcar #'lisp->obj-data args)) - (arglist (arglist-intersperse-types objc-args))) + (let ((objc-arglist (arglist->objc-arglist args)) + (selector (selector method-name))) (unwind-protect (with-foreign-conversion ((objc-receiver receiver)) (with-foreign-objects ((return-value (apply-macro '%objcl-invoke-method objc-receiver - method-name + (pointer-to selector) (length args) - arglist))) + objc-arglist))) (let ((*skip-retaining* (or *skip-retaining* (constructor-name-p method-name)))) (convert/signal return-value)))) - (mapc #'dealloc-obj-data objc-args))))) + (dealloc-objc-arglist objc-arglist))))) ;;; (@* "Helper functions") +(defun arglist->objc-arglist (arglist) + (arglist-intersperse-types (mapcar #'lisp->obj-data arglist))) + + +(defun dealloc-objc-arglist (objc-arglist) + (do ((objc-arglist objc-arglist (cddr objc-arglist))) + ((null objc-arglist)) + ;; (first objc-arglist) is a CFFI type name. + (dealloc-obj-data (second objc-arglist)))) + + (defun arglist-intersperse-types (arglist) (mapcan #'(lambda (arg) (list :pointer arg)) |