jeanp****@gmail*****
jeanp****@gmail*****
Mon May 7 14:53:01 JST 2007
On 4/24/07, jeanp****@gmail***** <jeanp****@gmail*****> wrote: > > On 4/24/07, Fujimoto Hisa <hisa****@fobj*****> wrote: > > > > I'm not good for TextMate, but writing plugin enabler for it may be > > almost same as sample/VPRubyPluginEnabler. > > > > * write plugin enabler (like sample/VPRubyPluginEnabler), it should > > run in the TextMate process. > > * the enabler should be written loading a ruby program as plugin. > > * loaded ruby program should run in the same process, so it's enable > > to access objects in the process. > > > hisa-san, i was hoping the textmate case might be similar to voodoopad so > i could study what you have done there. i have a VPRubyPluginEnabler-like > plugin for textmate, it simply loads a helper script that displays some > dialogues, calls NSBeep() and a few other assorted rubycocoa things. what i > now need to figure out is how to have it load the scripts (textmate > commands) so they are run in the same process. > i am still a bit stumped on this one. textmate plugins are normal NSObjects, so i am unsure how i can initialize my objc plugin to be fully rubycocoa savvy. calling RBBundleInit certainly allows me to call into ruby but after that returns, how do i call into ruby classes again? i think this is where rb_main usually kicks in and lets one repeatedly call in but i'm not really sure. i am thinking the easiest to accomplish a rubycocoa script running plugin in textmate would be to break the functionality in two. there will be a simple command line tool which uses some IPC to talk with the plugin to have it load and run[1] a script. kinda like this: script (ruby) -> tool --IPC-> plugin (objc) -> helper (ruby) which evals the script i thought i could simply declare the interface to my helper class and the runtime would resolve it (after requiring it in RBBundleInit) but i get link errors. so what am i missing, why can i repeatedly call into ruby classes in a rubycocoa application / RBApplicationMain but not with an NSObject / RBBundleInit? i cheated and used NSClassFromString but this only allowed me to link and it crashed on execution. alternatively, i could run the other end of the IPC (DO actually) in the ruby helper as called by RBBundleInit but i can't create a second thread to spin its own runloop. any suggestions? :) cheers, jean-pierre [1] it does not seem particularly safe to use IPC to trigger an eval() -------------- next part -------------- An HTML attachment was scrubbed... Descargar