From: Nathaniel I. <nd...@bu...> - 2008-06-18 01:20:31
|
On Tue, Jun 17, 2008 at 4:51 PM, Patrick Geiller <pge...@wa...> wrote: > Pasting > from /System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/oc_import.rb > > OCTYPES = { > :id => '@', > :class => '#', > :BOOL => 'c', > :char => 'c', > :uchar => 'C', > :short => 's', > :ushort => 'S', > :int => 'i', > :uint => 'I', > :long => 'l', > :ulong => 'L', > :float => 'f', > :double => 'd', > :bool => 'B', > :void => 'v', > :selector => ':', > :sel => ':', > :longlong => 'q', > :ulonglong => 'Q', > :cstr => '*', > } > > Note that bool and BOOL have different signatures. You're using bool ('B') > and Cocoa usually uses BOOL ('c'). That may explain your inconsistent > results. > Thanks! I'd seen this but still hadn't wrapped my head around the idea that single-character types were meaningful, in large part because the limechat.com examples all had too many characters to account for the arguments and return value. For instance: objc_method 'control:textView:doCommandBySelector:', 'B@:@@:' This is defined on NSControl to return a boolean, and accept an NSControl, an NSTextView, and a selector, so I would expect the stringified encoding to be "B@@:". Do I now understand correctly that the second and third characters above, "@:", are the self object and selector that Obj-C hides from message-passing syntax? That assumption at least produces sane values in my application. Thanks, -nat |