[MacRuby-devel] Initializing Pointer.new with specific value

2011-01-10 Thread Dave Baldwin
In OpenGL some functions take pointers and these are easily handled via v = Pointer.new('f', 20) glVertexPointer(3, GL_FLOAT, 3, v) (the C prototype is void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); however in some cases this function has been over

[MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
I'm trying to create a custom URL scheme following the instructions here http://www.cocoadev.com/index.pl?HowToRegisterURLHandler and in the Cocoa Scripting Guide p108. I've not been getting anywhere! I've got at least two problems here: (I'm running OS X 10.6.6 with MacRuby 0.8) # Attempt #1 # Ap

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Matt Aimonetti
In Ruby constants start by an upper case letter, swap `kInternetEventClass' by `KInternetEventClass' and give it a try. For a bit more info: http://ofps.oreilly.com/titles/9781449380373/ch01.html#_constant_names - Matt On Mon, Jan 10, 2011 at 9:05 AM, Martin Hawkins wrote: > I'm trying to create

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Thanks Matt, I've got the book but missed that point. Any suggestions re my second issue. i.e. translating the selector part of sharedAEManager.setEventHandler(self, andSelector:getURL(event, withReplyEvent:returnEvent), forEventClass:kInternetEventClass, andEventID:kAEGetURL) into it's Ruby equiva

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Joel Reymont
On Jan 10, 2011, at 5:52 PM, Martin Hawkins wrote: > sharedAEManager.setEventHandler(self, andSelector:getURL(event, > withReplyEvent:returnEvent), forEventClass:kInternetEventClass, > andEventID:kAEGetURL) This does not produce any errors: sharedAEManager.setEventHandler(self, andSelector:g

[MacRuby-devel] syntax highlighting

2011-01-10 Thread Joel Reymont
Is there anything I can piggyback on to implement syntax highlighting in a Cocoa editing window? Is there some Ruby lexing code, for example, that I can reuse? Thanks, Joel --- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont __

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
On 2011-01-10, at 15:52 , Martin Hawkins wrote: > > Thanks Matt, I've got the book but missed that point. > Any suggestions re my second issue. i.e. translating the selector part You can pass a selector as a symbol or string: m.setEventHandler(self, andSelector: :"getURL:event:withReplyEvent:re

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Joel, I've also got to change getURL to def getURL(event, returnEvent) # do something with event here to parse the url end so I go with your suggestion, I'm going to get 'wrong number of arguments (0 for 2)' On Jan 10, 5:59 pm, Joel Reymont wrote: > On Jan 10, 2011, at 5:52 PM, Martin Ha

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Excellent Caio - thanks. Now I've gone full circle and am getting 'AppDelegate::KInternetEventClass (NameError) from /Users/martin/work/macruby/experimental/build/Debug/ experimental.app/Contents/' Code is now: framework 'Foundation' # framework 'ApplicationServices' - it doesn't matter wh

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
On 2011-01-10, at 16:47 , Martin Hawkins wrote: > > Excellent Caio - thanks. > Now I've gone full circle and am getting > 'AppDelegate::KInternetEventClass (NameError) > from /Users/martin/work/macruby/experimental/build/Debug/ > experimental.app/Contents/' Maybe that constant is not there

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Now that's interesting - I tried your macirb experiment and get a different result: mar...@polaris:~ macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> KInternetEventClass NameError: uninitialized constant KInternetEventClass irb(main):003:0> framework 'Cocoa' => true irb(main

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
The constant *should* be there - this is an excerpt from my HIServices/ InternetConfig.h / Apple event constants *

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
Try installing the latest bridge support. http://bridgesupport.macosforge.org/trac/wiki/Releases On 2011-01-10, at 17:18 , Martin Hawkins wrote: > > Now that's interesting - I tried your macirb experiment and get a > different result: > mar...@polaris:~ macirb > irb(main):001:0> framework 'Found

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
That seems to have fixed it! Many thanks to you all for your help. On Jan 10, 7:59 pm, Caio Chassot wrote: > Try installing the latest bridge support. > > http://bridgesupport.macosforge.org/trac/wiki/Releases > > On 2011-01-10, at 17:18 , Martin Hawkins wrote: > > > > > > > > > Now that's inter

Re: [MacRuby-devel] syntax highlighting

2011-01-10 Thread Laurent Sansonetti
Hi Joel, For simplicity, I recommend to use the ripper extension for that. It has a lexer API. I don't know if there is sample code available, but the API itself isn't very difficult to understand and use. Look for the Ripper::Lexer class. Based on the returned tokens, you can then colorize you

[MacRuby-devel] convert array into a string

2011-01-10 Thread Joel Reymont
I would like to do mungedRegistration = [...] registrationString = NSString.stringWithUTF8String(mungedRegistration) but this results in can't convert Array into String (TypeError) What is the best approach here? I do need my munged registration to be an array since

Re: [MacRuby-devel] Initializing Pointer.new with specific value

2011-01-10 Thread Laurent Sansonetti
Hi Dave, I'm afraid this can't be done from MacRuby at the moment, and that the Objective-C wrapper is the best solution so far. However, if this is a common OpenGL function, maybe we need to find a solution for 1.0… consider filing a ticket. Laurent On Jan 10, 2011, at 5:42 AM, Dave Baldwin

Re: [MacRuby-devel] convert array into a string

2011-01-10 Thread Laurent Sansonetti
Assuming your array contains ASCII fixnum representation of characters, messaging #pack('c*') on it should give you a string object back. You can look up the documentation of Array#pack for more information. I dislike this method, but here I don't see a better choice. Laurent On Jan 10, 2011,

Re: [MacRuby-devel] convert array into a string

2011-01-10 Thread Caio Chassot
On 2011-01-10, at 19:19 , Laurent Sansonetti wrote: > > Assuming your array contains ASCII fixnum representation of characters, > messaging #pack('c*') on it should give you a string object back. > > I dislike this method, but here I don't see a better choice. numbers = [65, 195, 169] s = numbe

Re: [MacRuby-devel] convert array into a string

2011-01-10 Thread Laurent Sansonetti
On Jan 10, 2011, at 1:22 PM, Caio Chassot wrote: > On 2011-01-10, at 19:19 , Laurent Sansonetti wrote: >> >> Assuming your array contains ASCII fixnum representation of characters, >> messaging #pack('c*') on it should give you a string object back. >> >> I dislike this method, but here I don't

Re: [MacRuby-devel] convert array into a string

2011-01-10 Thread Joel Reymont
On Jan 10, 2011, at 9:19 PM, Laurent Sansonetti wrote: > Assuming your array contains ASCII fixnum representation of characters, > messaging #pack('c*') on it should give you a string object back. Do you mean something like [-188,-185,-186].#pack('c*') ? > You can look up the documentation of

Re: [MacRuby-devel] convert array into a string

2011-01-10 Thread Henry Maddocks
On 11/01/2011, at 10:29 AM, Joel Reymont wrote: > How do I lookup documentation? In your terminal ri Array#pack or Google. Henry ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/mac

Re: [MacRuby-devel] syntax highlighting

2011-01-10 Thread Grégoire Lejeune
I use Fragaria (https://github.com/mugginsoft/Fragaria) in Leonhard (https://github.com/glejeune/Leonhard) Greg Envoyé de mon iPhone Le 10 janv. 2011 à 19:00, Joel Reymont a écrit : > Is there anything I can piggyback on to implement syntax highlighting in a > Cocoa editing window? > > Is t

[MacRuby-devel] MacBacon, a fork of Bacon the RSpec clone.

2011-01-10 Thread Eloy Duran
Hi, I've just released a fork of the Bacon spec library for MacRuby. It specifically differs in the fact that it is NSRunloop aware, which is most visible in the `wait' method that allows you to schedule a block of assertions for later on the runloop. To be clear, the main thread is never halte

[MacRuby-devel] combining macrubyc with xcode

2011-01-10 Thread Joel Reymont
How do I combine compilation with macrubyc and xcode? I would like to use macrubyc in the Release configuration, to avoid distributing Ruby source code files. Thanks, Joel --- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ___

Re: [MacRuby-devel] combining macrubyc with xcode

2011-01-10 Thread Laurent Sansonetti
Build the Compile target. The target calls the macruby_deploy command-line tool, which calls macrubyc for you. You can pass --help in the command-line for more details. Laurent On Jan 10, 2011, at 3:51 PM, Joel Reymont wrote: > How do I combine compilation with macrubyc and xcode? > > I would