diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-03 18:08:07 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-08-03 18:08:07 +0200 |
commit | bc663521841d63b2cc847310aa58cffef561fed8 (patch) | |
tree | 03bd3ff977edf6034ede2998775e8e85bb7ce6e5 /objcl.lisp | |
parent | 2841f04d147c3f640e5a0b9787f5823a5f53e692 (diff) |
Use type Class rather than id for classes.
darcs-hash:da715b2f31d65a2ad3fa34d68b2e2445496c8f46
Diffstat (limited to 'objcl.lisp')
-rw-r--r-- | objcl.lisp | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -26,6 +26,7 @@ (defcunion obj-data-union (id-val :pointer) + (class-val :pointer) (sel-val :pointer) (char-val :char) (short-val :short) @@ -60,7 +61,8 @@ (argc :int) &rest) -(defcfun "objcl_invoke_class_method" obj-data +(defcfun ("objcl_invoke_class_method" + %objcl-invoke-class-method) obj-data (receiver obj-data) (method-name :string) (argc :int) @@ -69,6 +71,9 @@ (defcfun ("objcl_find_class" %objcl-find-class) :pointer (class-name :string)) +(defcfun ("objcl_class_name" %objcl-class-name) :string + (class obj-data)) + ;;; Copied from objc-api.h ;;; Probably ought to be generated by C code at initialisation time. @@ -107,7 +112,7 @@ (defparameter *objcl-data-map* '((id . id-val) - (class . id-val) + (class . class-val) (sel . sel-val) (chr . char-val) (uchr . char-val) @@ -215,6 +220,19 @@ (dealloc-obj-data return-value)))) +(defun objcl-invoke-class-method (class method-name &rest args) + (let* ((arglist (arglist-intersperse-types + (mapcar #'lisp->obj-data args))) + (return-value (apply-macro '%objcl-invoke-class-method + (lisp->obj-data class) + method-name + (length args) + arglist))) + (prog1 + (obj-data->lisp return-value) + (dealloc-obj-data return-value)))) + + (defun lisp->obj-data (value) (let ((obj-data (foreign-alloc 'obj-data)) (type-name (lisp-value->type-name value))) @@ -250,7 +268,7 @@ (if (null-pointer-p (foreign-slot-value (foreign-slot-value obj-data 'obj-data 'data) 'obj-data-union - 'id-val)) + 'class-val)) nil (obj-data->lisp obj-data)) (dealloc-obj-data obj-data)))) |