Hi Mathieu, On 13 Apr 2011, at 10:29, Mathieu Suen wrote:
> I use LKSendMessage for writing the binding to gnu-smalltalk. > I had pick most of the implementation from the LanguageKit. > (I don't know if LanguageKit build on osx without gnustep) The interpreter can, the compiler can't (well, it should built, it just won't work). > But I cam across an issue when sending a message with integer parameter like: > > NSWindows class>>#initWithContentRectPointer:styleMask:backing:defer: > > LKSendMessage unbox does integer as follow: > > > case 'I': > *(unsigned int*)dest = [value unsignedIntValue]; > break; Yup, this is extracting the unsigned integer representation (Objective-C type encoding 'I') from the object. >> From gnu-smalltalk I can't build the NSNumber because I need to send a >> message > like > > #numberWithInt: which should take a NSNumber as parameter... I'm not sure why you are building an NSNumber here at all. You just need the object to return an unsigned integer when sent an unsignedIntValue. The simplest way of doing this from Smalltalk code is likely to be right-shifting a SmallInt by one and then possibly zero-extending the result. NSNumber is a class that boxes C primitive integer values as objects, but in this case we are trying to unbox, not box, a value. The only time you'd need an NSNumber would be if one existed already and you passed it as a parameter to the method that expected an integer. > Any idea on how to solve this recursion? There shouldn't be any recursion here. David -- Sent from my STANTEC-ZEBRA _______________________________________________ Etoile-discuss mailing list [email protected] https://mail.gna.org/listinfo/etoile-discuss
