> Hi Russell,
> 
> Sorry for the late response.

no worries... :)


> OpenDirectory.framework ships with BridgeSupport annotations, so doing 
> "framework 'OpenDirectory'" should merge all symbols into MacRuby. If some 
> are missing, it's likely a bug in the BridgeSupport generator, that should be 
> reported via http://bugreport.apple.com.

cool - shall do... I wasn't doing that until I had some evidence it wasn't just 
me missing something...


> Fortunately, we are working on a new BridgeSupport generator which might 
> already fix this issue, but it's not ready yet for prime time. In the 
> meantime I recommend to wrap the symbols/APIs you need inside an Objective-C 
> class and call it from MacRuby.

I've ended up just running the relevant OpenDirectory headers through perl to 
generate an opendirectory/constants.rb that I pull into the other stuff I'm 
doing - pretty straightforward once I figured out where the strings I was after 
lived... in case anyone finds it useful, here's gen-constants.sh which pulls in 
both the enum constants and the extern NSString "constants" into a single ruby 
file...


#!/bin/sh

target_dir=$(dirname "$0")/../lib/opendirectory
target_file=${target_dir}/constants.rb

cat <<HEADER > $target_file
module OpenDirectory
  module Constants
HEADER

# enum constants
curl 
'http://www.opensource.apple.com/source/OpenDirectory/OpenDirectory-57/CFOpenDirectoryConstants.h?txt'
 | \
  perl -ne 'next unless /^\s*kOD([A-Za-z]+)\s*=\s*(0x[0-9a-fA-F]+)/; print qq(  
  $1 = $2\n)' >> $target_file

# string "constants"
curl 
'http://www.opensource.apple.com/source/OpenDirectory/OpenDirectory-57/CFOpenDirectoryConstants.c?txt'
 | \
  perl -ne 'next unless 
/^\s*CFStringRef\s+kOD([[:alpha:]]+)\s*=\s*CFSTR\((".*?")\)/; print qq(    $1 = 
$2\n)' >> $target_file

cat <<FOOTER >> $target_file
  end
end
FOOTER

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to