[MacRuby] #1049: Can't get the event path from FSEventStreamCallback

MacRuby ruby-noreply at macosforge.org
Fri Dec 17 14:43:57 PST 2010


#1049: Can't get the event path from FSEventStreamCallback
---------------------------+------------------------------------------------
 Reporter:  haxie1@…       |       Owner:  lsansonetti@…        
     Type:  defect         |      Status:  new                  
 Priority:  blocker        |   Milestone:                       
Component:  MacRuby        |    Keywords:                       
---------------------------+------------------------------------------------

Comment(by lsansonetti@…):

 The callback is defined like this:

 {{{
 typedef void ( *FSEventStreamCallback )(
     ConstFSEventStreamRef streamRef,
     void *clientCallBackInfo,
     size_t numEvents,
     void *eventPaths,
     const FSEventStreamEventFlags eventFlags[],
     const FSEventStreamEventId eventIds[]);
 }}}

 Here, eventPaths is a void pointer, so MacRuby will give you a Pointer
 object. However, apparently, it looks like FSEvents will yield an NSArray
 instead, in this snippet.

 In C, one would simply cast eventPaths as an NSArray, but in MacRuby, this
 isn't possible.

 Using #cast! on the Pointer will simply change the pointer type, and in
 your case, you're getting what an NSArray structure points to as its first
 pointer field, which is the isa (class).

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1049#comment:1>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list