Changeset 5727
- Timestamp:
- Jan 18, 2007, 3:09:51 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/objc-support.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/objc-support.lisp
r5696 r5727 6 6 (require "BRIDGE")) 7 7 8 #-apple-objc-2.0 9 (progn 10 (def-foreign-type :<CGF>loat :float) 11 (def-foreign-type :<NSUI>nteger :unsigned)' 12 (def-foreign-type :<NSI>nteger :signed)) 13 14 (defconstant +cgfloat-zero+ 15 #+(and apple-objc-2.0 64-bit-target) 0.0d0 16 #-(and apple-objc-2.0 64-bit-target) 0.0f0) 8 17 9 18 #+apple-objc … … 26 35 (return) 27 36 (funcall fn class)))))) 28 29 37 38 (defun %note-protocol (p) 39 (with-macptrs ((cname (objc-message-send p "name" :address))) 40 (let* ((namelen (%cstrlen cname)) 41 (name (make-string namelen))) 42 (declare (dynamic-extent name)) 43 (%str-from-ptr cname namelen name) 44 (unless (gethash name *objc-protocols*) 45 (setf (gethash (subseq name 0) *objc-protocols*) 46 (%inc-ptr p 0)))))) 47 48 (defun note-class-protocols (class) 49 #-apple-objc-2.0 50 (do* ((protocols (pref class :objc_class.protocols) 51 (pref protocols :objc_protocol_list.next))) 52 ((%null-ptr-p protocols)) 53 (let* ((count (pref protocols :objc_protocol_list.count))) 54 (with-macptrs ((list (pref protocols :objc_protocol_list.list))) 55 (dotimes (i count) 56 (with-macptrs ((p (paref list (:* (:* (:struct :<P>rotocol))) i))) 57 (%note-protocol p)))))) 58 #+apple-objc-2.0 59 (rlet ((p-out-count :int)) 60 (with-macptrs ((protocols (#_class_copyProtocolList class p-out-count))) 61 (let* ((n (pref p-out-count :int))) 62 (dotimes (i n) 63 (with-macptrs ((p (paref protocols (:* (:* (:struct :<P>rotocol))) i))) 64 (%note-protocol p)))) 65 (unless (%null-ptr-p protocols) (#_free protocols))))) 66 30 67 31 68 (defun map-objc-classes (&optional (lookup-in-database-p t)) 32 69 (iterate-over-objc-classes 33 70 #'(lambda (class) 71 (note-class-protocols class) 34 72 (install-foreign-objc-class class lookup-in-database-p)))) 35 73 … … 311 349 312 350 313 351 (defmethod print-object ((p ns:protocol) stream) 352 (print-unreadable-object (p stream :type t) 353 (format stream "~a (#x~x)" 354 (%get-cstring (send p 'name)) 355 (%ptr-to-int p)))) 356 314 357 315 358
Note:
See TracChangeset
for help on using the changeset viewer.
