Laurent Sansonetti
lsans****@apple*****
Wed May 16 22:06:14 JST 2007
Hi, Yesterday I committed RubyCocoa support for the prinf_format XML attributes in bridge support files. Something that I completely forgot to work on. What does that mean? Before, RubyCocoa used to handle APIs accepting a format string and a variable number of arguments in a quite stupid way, by converting all the variable arguments after the format string as if they were Objective-C objects (C_ID type). So, NSLog('%d', 42) didn't work, because the Fixnum 42 was converted into an NSNumber, and that %d expects a C integer. With the new committed support, RubyCocoa will know all APIs that have a format string argument, and at runtime it will parse the format string in order to know which type the variable arguments should be converted to. NSLog('%d %s %f %@', 42, 'foo', 42.42, 42) will work as expected: 1st will be converted as a C integer, 2nd as a C string, 3rd as a C floating numeric and 4th as a NSNumber. Laurent