Changeset 488
- Timestamp:
- Feb 7, 2004, 1:54:58 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/objc-runtime.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/objc-runtime.lisp
r486 r488 337 337 ) 338 338 339 (defun get-appkit-version () 340 (%get-double-float (foreign-symbol-address #+apple-objc "_NSAppKitVersionNumber" #+gnu-objc "NSAppKitVersionNumber"))) 341 342 (defun get-foundation-version () 343 (%get-double-float (foreign-symbol-address #+apple-objc "_NSFoundationVersionNumber" #+gnu-objc "NSFoundationVersionNumber"))) 344 345 (defparameter *appkit-library-version-number* (get-appkit-version)) 346 (defparameter *foundation-library-version-number* (get-foundation-version)) 347 348 (def-ccl-pointers cfstring-sections () 349 (reset-cfstring-sections) 350 (find-cfstring-sections)) 339 351 340 352 ;;; When starting up an image that's had ObjC classes in it, all of … … 354 366 ;; resolving those foreign classes that existed in the old 355 367 ;; image and still exist in the new. 368 (unless (= *foundation-library-version-number* (get-foundation-version)) 369 (format *error-output* "~&Foundation version mismatch: expected ~s, got ~s~&" 370 *Foundation-library-version-number* (get-foundation-version)) 371 (#_exit 1)) 372 (unless (= *appkit-library-version-number* (get-appkit-version)) 373 (format *error-output* "~&AppKit version mismatch: expected ~s, got ~s~&" 374 *appkit-library-version-number* (get-appkit-version)) 375 (#_exit 1)) 356 376 (let* ((class-map (objc-class-map)) 357 377 (metaclass-map (objc-metaclass-map)) … … 374 394 #+gnu-objc :objc_class.class_pointer))) 375 395 (splay-tree-put metaclass-map m meta-id)))))) 376 (break "second pass")377 396 ;; Second pass: install class objects for user-defined classes, 378 ;; assuming the superclasses are already "revived". 397 ;; assuming the superclasses are already "revived". If the 398 ;; superclass is itself user-defined, it'll appear first in the 399 ;; class table; that's an artifact of the current implementation. 379 400 (dotimes (i nclasses) 380 401 (let* ((c (id->objc-class i))) … … 386 407 (meta-id (objc-class-id->objc-metaclass-id i)) 387 408 (m (id->objc-metaclass meta-id))) 388 (when (%null-ptr-p m) 409 (unless (splay-tree-get metaclass-map m) 410 (%revive-macptr m) 389 411 (%setf-macptr m (%make-basic-meta-class 390 ( objc-metaclass-id-foreign-name meta-id)412 (make-cstring (objc-metaclass-id-foreign-name meta-id)) 391 413 super 392 ( @class "NSObject")))414 (find-class 'ns::ns-object))) 393 415 (splay-tree-put metaclass-map m meta-id)) 394 416 (%setf-macptr c (%make-class-object 395 417 m 396 418 super 397 ( objc-class-id-foreign-name i)419 (make-cstring (objc-class-id-foreign-name i)) 398 420 (%null-ptr) 399 421 0)) … … 402 424 (%add-objc-class c ivars instance-size) 403 425 (splay-tree-put class-map c i)))))))) 404 405 426 427 (pushnew #'revive-objc-classes *lisp-system-pointer-functions* 428 :test #'eq 429 :key #'function-name) 406 430 407 431 … … 1297 1321 imp))) 1298 1322 1299 1323 (def-ccl-pointers add-objc-methods () 1324 (maphash #'(lambda (impname m) 1325 (declare (ignore impname)) 1326 (%add-lisp-objc-method m)) 1327 *lisp-objc-methods*)) 1300 1328 1301 1329 (defun %define-lisp-objc-method (impname classname selname typestring imp … … 1516 1544 (setf (%get-ptr (foreign-symbol-address "__dealloc")) *original-deallocate-hook*)) 1517 1545 1518 #+testing1519 1546 (pushnew #'uninstall-lisp-deallocate-hook *lisp-cleanup-functions* :test #'eq 1520 1547 :key #'function-name)
Note:
See TracChangeset
for help on using the changeset viewer.
