Changeset 380
- Timestamp:
- Jan 24, 2004, 3:34:57 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/objc-runtime.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/objc-runtime.lisp
r230 r380 65 65 (unless (logtest #$_CLS_RESOLV (pref classptr :objc_class.info)) 66 66 (external-call "__objc_resolve_class_links" :void))) 67 68 67 69 68 70 (let* ((objc-class-map (make-splay-tree #'%ptr-eql … … 233 235 ;; in the thread that's going to process events. Looking up a 234 236 ;; symbol in the library should cause it to be initialized 237 (open-shared-library "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation") 235 238 (open-shared-library "/System/Library/Frameworks/Cocoa.framework/Cocoa") 236 239 (let* ((current (#_CFRunLoopGetCurrent)) … … 1137 1140 (values (objc-instance-p parent)))))) 1138 1141 1142 1143 #+apple-objc 1144 (defun zone-pointer-size (p) 1145 (with-macptrs ((zone (#_malloc_zone_from_ptr p))) 1146 (unless (%null-ptr-p zone) 1147 (let* ((size (ff-call (pref zone :malloc_zone_t.size) 1148 :address zone 1149 :address p 1150 :int))) 1151 (declare (fixnum size)) 1152 (unless (zerop size) 1153 size))))) 1154 1155 (defun %objc-instance-class-index (p) 1156 #+apple-objc 1157 (let* ((instance-apparent-size (zone-pointer-size p))) 1158 (when (and instance-apparent-size (not (eql instance-apparent-size 0))) 1159 (locally (declare (fixnum instance-apparent-size)) 1160 (with-macptrs ((parent (pref p :objc_object.isa))) 1161 (let* ((idx (objc-class-id parent))) 1162 (when idx 1163 (let* ((parent-size (if idx (pref parent :objc_class.instance_size)))) 1164 (if (eql (- (ash (ash (the fixnum (+ parent-size 17)) -4) 4) 2) 1165 instance-apparent-size) 1166 idx))))))))) 1167 #+gnu-objc 1168 (with-macptrs ((parent (pref p objc_object.class_pointer))) 1169 (objc-class-id-parent))) 1170 1139 1171 ;;; If an instance, return (values :INSTANCE <class>). 1140 1172 ;;; If a class, return (values :CLASS <metaclass>).
Note:
See TracChangeset
for help on using the changeset viewer.
