Satoshi Nakagawa
snaka****@infot*****
Sat Jun 30 00:07:54 JST 2007
Hi Laurent. > No just a few minutes, the fix is very trivial as you can see (it's a > one line change in RBObject.m). That's good :) > No problem at all. I could anyway verify on my PowerBook G4 running > 10.4.9, but having a second verification wouldn't hurt. I have tested again only on Intel, and updated the result: http://limechat.net/rubycocoa/bridge_test.html. It seems to work well on Intel. -- Satoshi Nakagawa On 2007/06/29, at 23:42, Laurent Sansonetti wrote: > Hi Satoshi-san, > > On Jun 29, 2007, at 4:21 PM, Satoshi Nakagawa wrote: > >> Hi Laurent. >> >> Wow great! >> Have you been working over night? > > No just a few minutes, the fix is very trivial as you can see (it's a > one line change in RBObject.m). > >> Now I have only Intel machines at home. >> I can do test on PPC machines only in my office. >> So I will try again in next Monday. >> Sorry for being late. > > No problem at all. I could anyway verify on my PowerBook G4 running > 10.4.9, but having a second verification wouldn't hurt. > > I think we should make a new release of RubyCocoa if this fix has been > verified as working. It's a bad regression :( > > Laurent > >> On 2007/06/29, at 23:10, Laurent Sansonetti wrote: >> >>> Should be fixed by r1874. >>> >>> * framework/src/objc/RBObject.m, >>> framework/src/objc/ocdata_conv.m, >>> tests/tc_bool.rb: >>> - Fixed a PPC regression when converting small integers (less than >>> 4 bytes) >>> from a metadata-driven Ruby method (ex: an informal protocol >>> method). >>> - Better generic Ruby -> ObjC boolean conversion, now trying to >>> respect the >>> Ruby semantics. Ruby's true and false are converted as true and >>> false, >>> all integers (including 0) are converted as true and nil as >>> false ; >>> - Added a test case (original code written by Kimura Wataru). >>> >>> Satoshi-san, can you verify? >>> >>> Thanks, >>> Laurent >>> >>> On Jun 29, 2007, at 2:09 PM, Laurent Sansonetti wrote: >>> >>>> Thanks Satoshi-san for the detailed report, I'm now working on this, >>>> in priority. >>>> >>>> Laurent >>>> >>>> On 6/29/07, Satoshi Nakagawa <snaka****@infot*****> wrote: >>>>> Hi. >>>>> >>>>> As I reported in rubycocoa:0434, >>>>> BOOL type conversions for informal protocol methods seem not to >>>>> work well. >>>>> >>>>> I have done an overall testing for the BridgeSupport type >>>>> conversions >>>>> around boolean values. >>>>> >>>>> You can see the result at: >>>>> >>>>> http://limechat.net/rubycocoa/bridge_test.html >>>>> >>>>> Kimura-san's test cases are for the cases of: >>>>> >>>>> - Ruby to Obj-C convertion (control_textView_doCommandBySelector) >>>>> - no objc_method informal protocol >>>>> >>>>> on the results table. >>>>> >>>>> It shows if you replace "B" for "C" of >>>>> 'control:textView:doCommandBySelector:', >>>>> the conversion works normally (except a problem, 0 should be >>>>> considered true). >>>>> >>>>> -- >>>>> Satoshi Nakagawa >>>>> >>>>> >>>>> On 2007/06/29, at 0:26, Laurent Sansonetti wrote: >>>>> >>>>>> It's surely a regression in RubyCocoa, but it's normal that the >>>>>> bridge >>>>>> support files mention 'B' instead of 'c'. gen_bridge_metadata >>>>>> automatically uses 'B' instead of 'c' for real boolean types >>>>>> (BOOL, >>>>>> bool, etc...) so that RubyCocoa can differentiate real booleans >>>>>> (BOOL) >>>>>> than char types. Because @encode(BOOL) == @encode(char). >>>>>> >>>>>> I will investigate the regression nevertheless. Thanks for the >>>>>> report. >>>>>> >>>>>> Laurent >>>>>> >>>>>> On Jun 28, 2007, at 5:13 PM, kimura wataru wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I received a bug report [rubycocoa:0434](ja). This mail >>>>>>> says an informal protocol method whose return type is BOOL >>>>>>> do not works fine. >>>>>>> >>>>>>> I wrote a test code. >>>>>>> >>>>>>> --- >>>>>>> require 'osx/cocoa' >>>>>>> require 'test/unit' >>>>>>> >>>>>>> class MyClass < OSX::NSObject >>>>>>> attr_accessor :bool >>>>>>> def control_textView_doCommandBySelector(control, textView, sel) >>>>>>> return @bool >>>>>>> end >>>>>>> #objc_method 'control:textView:doCommandBySelector:', 'c@:@@:' # >>>>>>> (1) >>>>>>> end >>>>>>> >>>>>>> class TCBool < Test::Unit::TestCase >>>>>>> def test_informal_protocol >>>>>>> rcv = MyClass.alloc.init >>>>>>> rcv.bool = false >>>>>>> val = rcv.ocm_send( >>>>>>> 'control:textView:doCommandBySelector:', nil, >>>>>>> nil, nil, '') >>>>>>> assert(!val) # fail on ppc Mac >>>>>>> rcv.bool = true >>>>>>> #$DEBUG = true >>>>>>> val = rcv.ocm_send( >>>>>>> 'control:textView:doCommandBySelector:', nil, >>>>>>> nil, nil, '') >>>>>>> $DEBUG = false >>>>>>> assert(val) >>>>>>> end >>>>>>> def test_ruby >>>>>>> rcv = MyClass.alloc.init >>>>>>> rcv.bool = false >>>>>>> val = rcv.control_textView_doCommandBySelector(nil, nil, '') >>>>>>> assert(!val) >>>>>>> rcv.bool = true >>>>>>> val = rcv.control_textView_doCommandBySelector(nil, nil, '') >>>>>>> assert(val) >>>>>>> end >>>>>>> end >>>>>>> --- >>>>>>> >>>>>>> This code fails with RubyCocoa trunk(r1853) and MacOSX 10.4.8ppc. >>>>>>> (succeeds on intel) >>>>>>> * add invoking objc_method (1), then the all of tests were passed >>>>>>> * edit AppKit.bridgesupport and modify the type encoding >>>>>>> "B20 at 0:4 at 8@12:16" -> "c20 at 0:4 at 8@12:16" ("B" -> "c"), then >>>>>>> the all of tests were passed >>>>>>> >>>>>>> I think the conflict of type encoding between objc-runtime and >>>>>>> bridgesupport file causes this problem. >>>>>>> >>>>>>> ObjC BOOL is described as type encoding "c", not "B". >>>>>>> "c" means signed char, and "B" means unsigned int. >>>>>>> >>>>>>> -- >>>>>>> kimura wataru