[Openmcl-devel] Getting a double-float from ObjC

Sebastian Nozzi sebnozzi at gmx.net
Sat Jun 19 21:41:23 UTC 2004


The problem seems to be that the bridge is calling REQUIRES-STRET-P with 
2 (as "2 words") as value and not with :UNSIGNED-DOUBLEWORD. In the last 
case, according to the code (which only just now I took the time to look 
at), it should work and return false. But called with a 2 makes the line

(> rspec 1)

return true.
I don't really know where, but what needs to be fixed is in one of the 
callers to REQUIRES-STRET-P, presumably in MAKE-OPTIMIZED-SEND. But I'm 
no Lisp expert yet and I'm not familiar at all with the workings of the 
bridge under the hood and I can only conjeturate (I would have loved to 
fix MAKE-OPTIMIZED-SEND by myself, but I'm not there yet).

I tried to trace as many functions as possible.
I hope this transcript helps:

? (send n 'unsigned-long-long-value )

  Calling (MAKE-OPTIMIZED-SEND N 'UNSIGNED-LONG-LONG-VALUE NIL NIL)

   Calling (PARSE-FOREIGN-TYPE :UNSIGNED-DOUBLEWORD)

   PARSE-FOREIGN-TYPE returned #<FOREIGN-INTEGER-TYPE (:UNSIGNED 64) 
#x62A6EB6>

   Calling (ENSURE-FOREIGN-TYPE-BITS #<FOREIGN-INTEGER-TYPE (:UNSIGNED 
64) #x62A6EB6>)

   ENSURE-FOREIGN-TYPE-BITS returned 64

   Calling (PARSE-FOREIGN-TYPE :UNSIGNED-DOUBLEWORD)

   PARSE-FOREIGN-TYPE returned #<FOREIGN-INTEGER-TYPE (:UNSIGNED 64) 
#x62A6EB6>

   Calling (BUILD-CALL N (@SELECTOR "unsignedLongLongValue") 
"unsignedLongLongValue" (2) NIL NIL NIL)

    Calling (REQUIRES-STRET-P 2)

    REQUIRES-STRET-P returned T

 > Error in process Listener-2(6): The message "unsignedLongLongValue" 
must be sent using SEND/STRET

 > While executing: BUILD-CALL


Gary Byers wrote:

> 
> On Sat, 19 Jun 2004, Sebastian Nozzi wrote:
> 
> 
>>Hi Gary,
>>
>>There might be a similar problem here:
>>(or doesn't OpenMCL support unsigned long longs?)
>>
>>? (setf num *)
>>#<NS-CF-NUMBER 6148 (#x1BAF70)>
>>
>>? (send num 'unsigned-long-long-value)
>> > Error in process Listener(5): The message "unsignedLongLongValue"
>>must be sent using SEND/STRET
>>
>> > While executing: BUILD-CALL
>>
>>(OpenMCL 0.14.2-p1)
> 
> 
> The version of REQUIRES-STRET-P that I mailed out in response to your
> earlier bug report (and that's now in 0.14 CVS) seems to recognize
> that :UNSIGNED-DOUBLEWORDs aren't returned in structures:
> 
> (defun requires-stret-p (rspec)
>   (when (member rspec '(:DOUBLE-FLOAT :UNSIGNED-DOUBLEWORD :SIGNED-DOUBLEWORD)
> 		:test #'eq)
>     (return-from requires-stret-p nil))
>   (setq rspec (fudge-objc-type rspec))
>   (if (numberp rspec)
>     (> rspec 1)
>     (> (ensure-foreign-type-bits (parse-foreign-type rspec)) 32)))
> 
> What version of this function is failing ?  What happens if you
> 
> ? (trace ccl::requires-stret-p)
> 
> and try to compile:
> 
> ? (send num 'unsigned-long-long-value)
> 
> ?
> 
> 



More information about the Openmcl-devel mailing list