Changeset 7471


Ignore:
Timestamp:
Oct 18, 2007, 3:14:32 PM (13 years ago)
Author:
rme
Message:

When generating ff-calls to objc methods that have
formal parameters of type CGFloat, coerce the actual
parameter to the appropriate kind of float.

This coercion is not performed for variadic methods

Location:
trunk/ccl/objc-bridge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/objc-bridge/bridge.lisp

    r7447 r7471  
    2323(require "OBJC-RUNTIME")
    2424(require "NAME-TRANSLATION")
    25 
    26 #-apple-objc-2.0
    27 (progn
    28   (def-foreign-type :<CGF>loat :float)
    29   (def-foreign-type :<NSUI>nteger :unsigned)
    30   (def-foreign-type :<NSI>nteger :signed)
    31   )
    32 
    33 (defconstant +cgfloat-zero+
    34   #+(and apple-objc-2.0 64-bit-target) 0.0d0
    35   #-(and apple-objc-2.0 64-bit-target) 0.0f0)
    36 
    37 (deftype cgfloat ()
    38   #+(and apple-objc-2.0 64-bit-target) 'double-float
    39   #-(and apple-objc-2.0 64-bit-target) 'single-float)
    40 
    41 (deftype cg-float () 'cgfloat)
    42 
    43 (deftype nsuinteger ()
    44   #+(and apple-objc-2.0 64-bit-target) '(unsigned-byte 64)
    45   #-(and apple-objc-2.0 64-bit-target) '(unsigned-byte 32))
    46 
    47 (deftype nsinteger ()
    48   #+(and apple-objc-2.0 64-bit-target) '(signed-byte 64)
    49   #-(and apple-objc-2.0 64-bit-target) '(signed-byte 32))
    5025
    5126;;; Used in PRINT-OBJECT methods.
  • trunk/ccl/objc-bridge/objc-runtime.lisp

    r7450 r7471  
    5757  (require "NAME-TRANSLATION")
    5858  (require "OBJC-CLOS"))
     59
     60;;; NSInteger and NSUInteger probably belong here.
     61;;; CGFloat not so much.
     62
     63#-apple-objc-2.0
     64(progn
     65  (def-foreign-type :<CGF>loat :float)
     66  (def-foreign-type :<NSUI>nteger :unsigned)
     67  (def-foreign-type :<NSI>nteger :signed)
     68  )
     69
     70(defconstant +cgfloat-zero+
     71  #+(and apple-objc-2.0 64-bit-target) 0.0d0
     72  #-(and apple-objc-2.0 64-bit-target) 0.0f0)
     73
     74(deftype cgfloat ()
     75  #+(and apple-objc-2.0 64-bit-target) 'double-float
     76  #-(and apple-objc-2.0 64-bit-target) 'single-float)
     77
     78(deftype cg-float () 'cgfloat)
     79
     80(deftype nsuinteger ()
     81  #+(and apple-objc-2.0 64-bit-target) '(unsigned-byte 64)
     82  #-(and apple-objc-2.0 64-bit-target) '(unsigned-byte 32))
     83
     84(deftype nsinteger ()
     85  #+(and apple-objc-2.0 64-bit-target) '(signed-byte 64)
     86  #-(and apple-objc-2.0 64-bit-target) '(signed-byte 32))
     87
    5988
    6089(defloadvar *NSApp* nil )
     
    18281857                   (:<BOOL> (call `(%coerce-to-bool ,arg)))
    18291858                   (:id (call `(%coerce-to-address ,arg)))
     1859                   (:<CGF>loat (call `(float ,arg +cgfloat-zero+)))
    18301860                   (t
    18311861                    (call arg)))))
Note: See TracChangeset for help on using the changeset viewer.