I found another problem with the x86-64 runtime by running the "cocoa"  
vocab tests. (Fancy that!) It looks like the second half of an NSRect  
struct gets copied into the first half when sent through an objc  
message:

{ [ 1.0 ] [ "x" get NSRect-x ] }
Assertion failed
Expect: { 1.0 }
Got:    { 101.0 }
Traceback
{ [ 2.0 ] [ "x" get NSRect-y ] }
Assertion failed
Expect: { 2.0 }
Got:    { 102.0 }
Traceback
{ [ 1.0 ] [ "x" get NSRect-x ] }
Assertion failed
Expect: { 1.0 }
Got:    { 101.0 }
Traceback
{ [ 2.0 ] [ "x" get NSRect-y ] }
Assertion failed
Expect: { 2.0 }
Got:    { 102.0 }

The test constructs an NSRect with x=1.0, y=2.0, w=101.0, h=102.0, and  
sends it through a message call to a Factor-defined objc class. On the  
other end it shows up with x=101.0, y=102.0, w=101.0, h=102.0. I  
observed this same behavior while debugging calls into AppKit; NSView  
frame rects were showing up with the origin equal to the size, so the  
problem appears to be on the alien invocation side.

I tried reproducing the problem by writing C functions that take an  
NSRect:

void show_NSRect(NSRect r)
{
     NSLog(@"%f %f %f %f", r.origin.x, r.origin.y, r.size.width,  
r.size.height);
}

void show_NSRect_b(void *a, void *b, NSRect r) // like IMP(id, SEL,  
NSRect)
{
     NSLog(@"%f %f %f %f", r.origin.x, r.origin.y, r.size.width,  
r.size.height);
}

Calling them from factor, everything worked as expected:

( scratchpad ) FUNCTION: void show_NSRect ( NSRect r ) ;
( scratchpad ) FUNCTION: void show_NSRect_b ( void* a, void* b, NSRect  
r ) ;
( scratchpad ) 1 2 3 4 <NSRect> show_NSRect
2008-09-10 20:27:27.189 factor[10388:10b] 1.000000 2.000000 3.000000  
4.000000
( scratchpad ) f f 1 2 3 4 <NSRect> show_NSRect_b
2008-09-10 20:27:40.805 factor[10388:10b] 1.000000 2.000000 3.000000  
4.000000

Is there some more magic to the objc interface than calling out to  
objc_msgSend with the given parameters?

-Joe

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to