Changeset 6058


Ignore:
Timestamp:
Mar 18, 2007, 2:14:17 AM (13 years ago)
Author:
gb
Message:

New approach to protocols; move some definitions earlier in the rats nest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/objc-gf/ccl/examples/objc-support.lisp

    r5937 r6058  
    99  (send class 'alloc))
    1010
    11 
    12 #-apple-objc-2.0
    13 (progn
    14   (def-foreign-type :<CGF>loat :float)
    15   (def-foreign-type :<NSUI>nteger :unsigned)
    16   (def-foreign-type :<NSI>nteger :signed)
    17   )
    18 
    19 (defconstant +cgfloat-zero+
    20   #+(and apple-objc-2.0 64-bit-target) 0.0d0
    21   #-(and apple-objc-2.0 64-bit-target) 0.0f0)
    22 
    23 (deftype cg-float ()
    24     #+(and apple-objc-2.0 64-bit-target) 'double-float
    25     #-(and apple-objc-2.0 64-bit-target) 'single-float)
     11(defun conforms-to-protocol (thing protocol)
     12  (objc-message-send thing "conformsToProtocol:" :address (objc-protocol-address protocol) :<BOOL>))
     13
     14
     15
    2616
    2717#+apple-objc
     
    5141      (declare (dynamic-extent name))
    5242      (%str-from-ptr cname namelen name)
    53       (unless (gethash name *objc-protocols*)
    54         (setf (gethash (subseq name 0) *objc-protocols*)
    55               (%inc-ptr p 0))))))
     43      (let* ((proto (or (gethash name *objc-protocols*)
     44                        (progn
     45                          (setq name (subseq name 0))
     46                          (setf (gethash name *objc-protocols*)
     47                                (make-objc-protocol :name name))))))
     48        (unless (objc-protocol-address proto)
     49          (setf (objc-protocol-address proto) (%inc-ptr p 0)))
     50        proto))))
    5651
    5752(defun note-class-protocols (class)
Note: See TracChangeset for help on using the changeset viewer.