[MacRuby-devel] CFRange (Boxed) elements not accessible

ecin ecin at copypastel.com
Tue Jun 1 09:40:05 PDT 2010


On a related note, editing the BridgeSupport file for DictionaryServices also solved my problems when dealing with Boxed objects. The following code (by Craig):

framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/DictionaryServices.framework'

word         = 'History'
word_len = DCSGetTermRangeInString(nil, word, 0);
res            = DCSCopyTextDefinition(nil, word, word_len)

puts "Definition for: #{word}"
puts res

would crash since DCSGetTermRangeInString wouldn't return a proper CFRange. Changing

<function name='DCSGetTermRangeInString'>
<arg type='^{__DCSDictionary=}'/>
<arg type='^{__CFString=}'/>
<arg type64='q' type='l'/>
<retval type64='{?=qq}' type='{?=ii}'/>
</function>

to 

<function name='DCSGetTermRangeInString'>
<arg type='^{__DCSDictionary=}'/>
<arg type='^{__CFString=}'/>
<arg type64='q' type='l'/>
<retval type64='{_CFRange=qq}' type='{_CFRange=ii}'/>
</function>

in /System/Library/Frameworks/CoreServices.framework/Frameworks/DictionaryServices.framework/Resources/BridgeSupport/DictionaryServices.bridgesupport did the trick. Seems like macruby-head doesn't have to deal with these issues though.


More information about the MacRuby-devel mailing list