Re: [MacRuby-devel] [MacRuby] #628: CTFramesetterCreateFrame doesn't like the CFRange type

2010-05-06 Thread Paul Howson
On 06/05/2010, at 1:18 PM, Laurent Sansonetti wrote:

> Hi Paul,
> 
> On May 5, 2010, at 7:57 PM, Paul Howson wrote:
> 
>> On 26/04/2010, at 1:33 PM, MacRuby wrote:
>> 
>> Hi Laurent,
>> 
>> What would be a feasible workaround for this problem, given than I'm using 
>> MacRuby 0.5 ?
>> 
>> i.e. I'm also trying to call:
>> 
>> CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, nil)
>> 
>> The second argument is a range which produces the error.
>> 
>> Can I edit the bridge support file? Or is there some other workaround? Can I 
>> use a more recent built of MacRuby? Or are these too buggy compared to 0.5?
> 
> Do you have any reason why you cannot use 0.6? It's much stabler than 0.5 :)
> 
> http://www.macruby.org/blog/2010/04/30/macruby06.html
> 
> Laurent

No reason other than I had not yet noticed the announcement of 0.6! I will 
upgrade.

Thanks.
Paul
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #694: framework 'Cocoa' in macirb crashes 0.6, 0.7

2010-05-06 Thread MacRuby
#694: framework 'Cocoa' in macirb crashes 0.6, 0.7
-+--
 Reporter:  mar...@… |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:   
Component:  MacRuby  |Keywords:   
-+--
 {{{
 787 $ macirb
 irb(main):001:0> framework 'Cocoa'
 framework 'Cocoa'
 unknown: [BUG] Segmentation fault
 MacRuby version 0.7 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 Abort trap
 788 $ }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #694: framework 'Cocoa' in macirb crashes 0.6, 0.7

2010-05-06 Thread MacRuby
#694: framework 'Cocoa' in macirb crashes 0.6, 0.7
-+--
 Reporter:  mar...@… |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:   
Component:  MacRuby  |Keywords:   
-+--

Comment(by hghoe...@…):

 {{{
 macirb
 irb(main):001:0> framework 'Cocoa'
 => true
 irb(main):002:0> MACRUBY_REVISION
 => "svn revision 4025 from
 http://svn.macosforge.org/repository/ruby/MacRuby/trunk";
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #694: framework 'Cocoa' in macirb crashes 0.6, 0.7

2010-05-06 Thread MacRuby
#694: framework 'Cocoa' in macirb crashes 0.6, 0.7
-+--
 Reporter:  mar...@… |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:   
Component:  MacRuby  |Keywords:   
-+--

Comment(by martinlagarde...@…):

 No issue here either:
 {{{
 $> macirb
 irb(main):001:0> framework 'Cocoa'
 => true
 irb(main):002:0> MACRUBY_REVISION
 => "svn revision 4032 from
 http://svn.macosforge.org/repository/ruby/MacRuby/trunk";
 }}}

 Can you give a little more details?

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #695: Bitwise operations on Float results in Seg fault

2010-05-06 Thread MacRuby
#695: Bitwise operations on Float results in Seg fault
---+
 Reporter:  nik...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:   
---+
 MacRuby allows bitwise operations on Float but crashes with a segmentation
 fault when called:

 {{{
 irb(main):001:0> (1.2 | 1)
 unknown: [BUG] Segmentation fault
 MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 zsh: abort  macirb
 nik...@fnh-macbook:~/ > macirb
 irb(main):001:0> ~1.2
 unknown: [BUG] Segmentation fault
 MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 zsh: abort  macirb
 irb(main):001:0> (1.2 < 1)
 unknown: [BUG] Segmentation fault
 MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 zsh: abort  macirb
 nik...@fnh-macbook:~/ > macirb
 irb(main):001:0> (1.2 ^ 1)
 unknown: [BUG] Segmentation fault
 MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 zsh: abort  macirb

 }}}

 Although there is no use in calling a bitwise operator on Float it
 shouldn't end in a segmentation fault but in a NoMethodError.

 Tested on MacRuby 0.6 on 10.6.3

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Accessing objc methods aliased by ruby methods

2010-05-06 Thread Dave Baldwin
For example, the method 'class' is present in objective C as well as in Ruby 
but invoking obj.class will use the Ruby version  How do I force the objc 
version to be used instead?  Obviously if the two version do the same thing 
then this is a moot issue but if they do different things you may need to 
choose the 'hidden' version.

Thanks,

Dave.

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #694: framework 'Cocoa' in macirb crashes 0.6, 0.7

2010-05-06 Thread MacRuby
#694: framework 'Cocoa' in macirb crashes 0.6, 0.7
-+--
 Reporter:  mar...@… |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:   
Component:  MacRuby  |Keywords:   
-+--

Comment(by lsansone...@…):

 Please attach the crash log file (you can find it in
 ~/Library/Logs/CrashReporter) or a gdb backtrace.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #680: String.crypt crashes when called with no arguments

2010-05-06 Thread MacRuby
#680: String.crypt crashes when called with no arguments
---+
 Reporter:  nik...@…   |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  minor  |Milestone:  MacRuby 0.7  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  MacRuby 0.6 => MacRuby 0.7


Comment:

 Should be fixed in r4033.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #695: Bitwise operations on Float results in Seg fault

2010-05-06 Thread MacRuby
#695: Bitwise operations on Float results in Seg fault
---+
 Reporter:  nik...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:   
---+

Comment(by lsansone...@…):

 Looks like these operations should not be callable on floats. However, on
 my environment I cannot reproduce the crashes:

 {{{
 $ ./miniruby -e "p (1.2 | 1)"
 1.23
 $ ./miniruby -e "p ~1.2"
 -3.59
 $ ./miniruby -e "p (1.2 < 1)"
 false
 $ ./miniruby -e "p (1.2 ^ 1)"
 1.17
 }}}

 Do you have a backtrace or crash report to share?

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] v0.7 and v0.6 timeout problem

2010-05-06 Thread Thibault Martin-Lagardette
Hi!

I cannot really reproduce this unfortunately, but I would have a couple of 
questions:
- That might be stupid, but did you try rebooting?
- What language are you using on your system?
- Did you ever try to "shrink" applications by getting rid of different 
languages?

Thanks :-)

-- 
Thibault Martin-Lagardette



On May 5, 2010, at 22:10, B. Ohr wrote:

> Hi, I have strange timeout problems with 0.6 and 0.7
> 
> $ time macruby_select 0.7 -e 'framework "Cocoa"'
> 2010-05-06 07:03:55.018 macruby[1922:607] 
> __CFServiceControllerBeginPBSLoadForLocalizations timed out while talking to 
> pbs
> real  0m1.588s
> user  0m0.699s
> sys   0m0.096s
> 
> 0.6 takes even longer:
> 
> $ time macruby_select 0.6 -e 'framework "Cocoa"'
> 2010-05-06 07:03:43.672 macruby[1913:607] 
> __CFServiceControllerBeginPBSLoadForLocalizations timed out while talking to 
> pbs
> real  0m2.170s
> user  0m0.698s
> sys   0m0.102s
> 
> while 0.5 has no timeout:
> 
> $ time macruby_select 0.5 -e 'framework "Cocoa“‘
> real  0m0.398s
> user  0m0.380s
> sys   0m0.057s
> 
> I’m still on OS X Version 10.6.2, is that the reason?
> 
> In the meantime I removed the MacRuby runtimes ala Matt Aimonetti, but that 
> did’nt help.
> 
> - Bernd
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #695: Bitwise operations on Float results in Seg fault

2010-05-06 Thread MacRuby
#695: Bitwise operations on Float results in Seg fault
---+
 Reporter:  nik...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:   
---+

Comment(by martinlagarde...@…):

 I reproduced on 10.6.3. Here is the backtrace:
 {{{
 Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
 0   libSystem.B.dylib 0x7fff849a6886 __kill + 10
 1   libSystem.B.dylib 0x7fff84a46eae abort + 83
 2   miniruby  0x00010003dd7d rb_bug + 205
 (error.c:229)
 3   miniruby  0x0001000b1920 sigbus + 0
 (signal.c:378)
 4   libSystem.B.dylib 0x7fff849b880a _sigtramp + 26
 5   libobjc.A.dylib   0x7fff82c3310a objc_msgSend + 22
 6   miniruby  0x00010016f846 nsnumber_or + 38
 (NSNumber.m:271)
 7   miniruby  0x00010013b29a rb_vm_dispatch +
 6826 (dispatcher.cpp:146)
 8   ???   0x000100e4c062 0 + 4309958754
 9   miniruby  0x00010014c6fc rb_vm_run + 348
 (vm.cpp:4003)
 10  miniruby  0x00010003ffd9 ruby_run_node +
 73 (eval.c:202)
 11  miniruby  0x0001000e6c48 main + 152
 (main.cpp:40)
 12  miniruby  0x000100019628 start + 52
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #684: MacRuby cannot run tests using the Shoulda gem

2010-05-06 Thread MacRuby
#684: MacRuby cannot run tests using the Shoulda gem
+---
 Reporter:  m...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  major   |Milestone:   
Component:  MacRuby |   Resolution:  duplicate
 Keywords:  |  
+---
Changes (by martinlagarde...@…):

  * status:  new => closed
  * resolution:  => duplicate


-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #691: Runtime should allow pointer types for C-string arguments

2010-05-06 Thread MacRuby
#691: Runtime should allow pointer types for C-string arguments
+---
 Reporter:  m...@…  |Owner:  lsansone...@…
 Type:  enhancement |   Status:  closed   
 Priority:  major   |Milestone:  MacRuby 0.7  
Component:  MacRuby |   Resolution:  fixed
 Keywords:  |  
+---
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Should be fixed in r4034. I haven't tried this specific OpenGL function
 but the following snippet works:

 {{{
 $ cat t.rb
 framework 'Foundation'
 s = NSString.stringWithString('foo')
 ptr = Pointer.new(:char, 4)
 p s.getCString(ptr, maxLength: 4, encoding: NSASCIIStringEncoding)
 4.times { |i| p ptr[i].chr }

 $ ./miniruby t.rb
 true
 "f"
 "o"
 "o"
 "\x00"
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #685: inject doesn't work with Procs

2010-05-06 Thread MacRuby
#685: inject doesn't work with Procs
-+--
 Reporter:  hghoe...@…   |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:  MacRuby 0.7  
Component:  MacRuby  |Keywords:   
-+--

Comment(by martinlagarde...@…):

 I guess this error is related to that:
 {{{
 $> ruby19  -e 'p :+.to_proc.call(1, 2)'
 3
 $> macruby -e 'p :+.to_proc.call(1, 2)'
 /private/tmp/-e:1:in `': wrong number of arguments (0 for 1)
 (ArgumentError)
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #690: calling `!= nil' on an NSString raises a TypeError exception

2010-05-06 Thread MacRuby
#690: calling `!= nil' on an NSString raises a TypeError exception
---+
 Reporter:  lsansone...@…  |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  blocker|Milestone:  MacRuby 0.7  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Should be fixed in r4035.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #669: Unable to find QTKit constant within a MacRuby app

2010-05-06 Thread MacRuby
#669: Unable to find QTKit constant within a MacRuby app
+---
 Reporter:  martinlagarde...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  major   |Milestone:  MacRuby 0.7  
Component:  MacRuby |   Resolution:  fixed
 Keywords:  qtkit   |  
+---
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 This has been fixed in r4016.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks

2010-05-06 Thread MacRuby
#692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  minor   |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by lsansone...@…):

 As recommended in the tutorial, the following lines can be added in
 rb_main.rb:

 {{{
 $:.map! { |x| x.sub(/^\/Library\/Frameworks/,
 NSBundle.mainBundle.privateFrameworksPath) }
 $:.unshift NSBundle.mainBundle.resourcePath.fileSystemRepresentation
 }}}

 However, as you say, it makes sense for MacRuby to set up its load path
 relative to where MacRuby.framework was loaded. We will address that
 problem.

 Just to be sure, we are talking about Ruby files here? In theory all
 binary files should be re-linked to point to the copy of MacRuby.framework
 inside the .app.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Accessing objc methods aliased by ruby methods

2010-05-06 Thread Laurent Sansonetti
Hi Dave,

#class is really a corner case here, we force the Ruby version when calling it 
from Ruby because it's slightly different than the Cocoa version. (+[NSObject 
class] returns self, while Ruby expects Module or Class to be returned). If you 
want to use the Cocoa version, you can use -performSelector:.

All other methods are unified, so you should never have the problem of choosing 
which version you want to call.

As an example, String#size is implemented in MacRuby core, but String#length is 
simply -[NSString length], implemented in Foundation.

Laurent

On May 6, 2010, at 12:05 PM, Dave Baldwin wrote:

> For example, the method 'class' is present in objective C as well as in Ruby 
> but invoking obj.class will use the Ruby version  How do I force the objc 
> version to be used instead?  Obviously if the two version do the same thing 
> then this is a moot issue but if they do different things you may need to 
> choose the 'hidden' version.
> 
> Thanks,
> 
> Dave.
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] FTP in MacRuby

2010-05-06 Thread Laurent Sansonetti
Hi Daniel,

This looks like a bug in MacRuby, could you report this to the tracker? We will 
continue the investigation there.

Thanks,

Laurent

On May 5, 2010, at 5:07 PM, Daniel Fontaine wrote:

> Does Net::FTP not work on MacRuby 0.6? I am trying a simple 
> Net::FTP.new(server, user, password) and receive
> 
> EOFError: end of file reached
>   from 
> /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/monitor.rb:188:in
>  `synchronize'
>   from 
> /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/monitor.rb:188:in
>  `synchronize'
> 
> The same method works fine under standard ruby.
> 
> I am new to MacRuby, so sorry if this is a known issue.
> 
> thanks,
> Dan
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks

2010-05-06 Thread MacRuby
#692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  minor   |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by m...@…):

 That's correct, ruby files only. The Mach-O binaries are correctly
 modified to be relative to the loader.

 Thanks!

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #695: Bitwise operations on Float results in Seg fault

2010-05-06 Thread MacRuby
#695: Bitwise operations on Float results in Seg fault
---+
 Reporter:  nik...@…   |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  major  |Milestone:  MacRuby 0.7  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Should be fixed in r4036.

 {{{
 $ ./miniruby -e "p (1.2 | 1)"
 /Users/lrz/src/MacRuby-trunk/-e:1:in `': undefined method `|' for
 1.2:Float (NoMethodError)
 $ ./miniruby -e "p ~1.2"
 /Users/lrz/src/MacRuby-trunk/-e:1:in `': undefined method `~' for
 1.2:Float (NoMethodError)
 $ ./miniruby -e "p (1.2 < 1)"
 false
 $ ./miniruby -e "p (1.2 ^ 1)"
 /Users/lrz/src/MacRuby-trunk/-e:1:in `': undefined method `^' for
 1.2:Float (NoMethodError)
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #696: net/ftp doesn't work

2010-05-06 Thread MacRuby
#696: net/ftp doesn't work
---+
 Reporter:  daniel.fonta...@…  |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  blocker|   Milestone:   
Component:  MacRuby|Keywords:   
---+
 Net::FTP.new(server, user, password) gives the following error in MacRuby
 0.6

 EOFError: end of file reached
 from
 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/monitor.rb:188:in
 `synchronize'
 from
 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/monitor.rb:188:in
 `synchronize'

 Works fine under standard ruby.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #697: potential regex bug

2010-05-06 Thread MacRuby
#697: potential regex bug
---+
 Reporter:  daniel.fonta...@…  |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  blocker|   Milestone:   
Component:  MacRuby|Keywords:   
---+
 I tried to use the coderay syntax highlighting gem. The following trivial
 statement gives a a regex compiling error.

 require 'rubygems'
 require 'coderay'

 # output as HTML div (using inline CSS styles)
 puts CodeRay.scan('puts "Hello, world!"', :ruby).div

 --

 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/coderay-0.9.3/lib/coderay/encoders/html.rb:126:
 regexp `[\t"&><\0-\x8\xB-\x1f] 'compilation error:
 U_REGEX_BAD_ESCAPE_SEQUENCE
 SyntaxError: compile error
 from
 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/coderay-0.9.3/lib/coderay/helpers/plugin.rb:189:in
 `block'
 from
 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/coderay-0.9.3/lib/coderay/helpers/plugin.rb:47:in
 `load:'
 from
 
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/coderay-0.9.3/lib/coderay/tokens.rb:121:in
 `method_missing:'
 from /Users/dan/(irb):6:in `'

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Paul Howson
I need some help with this example which arises at the boundary between MacRuby 
and the C Core Text framework.

Consider the following Core Text function definition:

 void CTFrameGetLineOrigins( CTFrameRef frame, CFRange range, CGPoint 
origins[] )

The third argument is defined as:

"origins
The buffer to which the origins are copied. The buffer must have at least as 
many elements as specified by range's length."

Clearly origins is a buffer and a series of CGPoint structures are copied into 
it.

How can this be handled in MacRuby? Specifically:

1. What kind of argument should be passed? Presumably something constructed 
using the Pointer.new_with_type() function? Documentation on this function is 
very hard to find.

2. How to access the individual CGPoints in the returned buffer? This is not an 
Objective-C / MacRuby array object. It is just an address to a buffer. Easy to 
do in C, but how to do in MacRuby?


Paul Howson
Warwick Qld Australia
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Laurent Sansonetti
Hi Paul,

On May 6, 2010, at 7:59 PM, Paul Howson wrote:

> I need some help with this example which arises at the boundary between 
> MacRuby and the C Core Text framework.
> 
> Consider the following Core Text function definition:
> 
> void CTFrameGetLineOrigins( CTFrameRef frame, CFRange range, CGPoint 
> origins[] )
> 
> The third argument is defined as:
> 
> "origins
> The buffer to which the origins are copied. The buffer must have at least as 
> many elements as specified by range's length."
> 
> Clearly origins is a buffer and a series of CGPoint structures are copied 
> into it.
> 
> How can this be handled in MacRuby? Specifically:
> 
> 1. What kind of argument should be passed? Presumably something constructed 
> using the Pointer.new_with_type() function? Documentation on this function is 
> very hard to find.

You're right, the Pointer class must be used. Sorry about the lack of 
documentation. Here is a snippet that might work:

# n must be defined
origins = Pointer.new(CGPoint.type, n) # this builds a pointer to n times 
CGPoint
CTFrameGetLineOrigins(frame, CFRange.new(0, n), origins)

> 2. How to access the individual CGPoints in the returned buffer? This is not 
> an Objective-C / MacRuby array object. It is just an address to a buffer. 
> Easy to do in C, but how to do in MacRuby?

Using Pointer#[] you can simply dereference a given slot in the pointer, as in 
C.

n.times { |i| p origins[i] } # should print nth points

Let me know if this works or not for you.

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Jordan K. Hubbard

On May 6, 2010, at 8:03 PM, Laurent Sansonetti wrote:

> You're right, the Pointer class must be used. Sorry about the lack of 
> documentation. Here is a snippet that might work:
> 
> # n must be defined
> origins = Pointer.new(CGPoint.type, n) # this builds a pointer to n times 
> CGPoint
> CTFrameGetLineOrigins(frame, CFRange.new(0, n), origins)
> 
>> 2. How to access the individual CGPoints in the returned buffer? This is not 
>> an Objective-C / MacRuby array object. It is just an address to a buffer. 
>> Easy to do in C, but how to do in MacRuby?
> 
> Using Pointer#[] you can simply dereference a given slot in the pointer, as 
> in C.
> 
> n.times { |i| p origins[i] } # should print nth points
> 
> Let me know if this works or not for you.

If it does, I can see this being a useful entry in Matt's book!

- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Matt Aimonetti

Duly noted ;)

Sent from my iPhone

On May 6, 2010, at 20:06, "Jordan K. Hubbard"  wrote:



On May 6, 2010, at 8:03 PM, Laurent Sansonetti wrote:

You're right, the Pointer class must be used. Sorry about the lack  
of documentation. Here is a snippet that might work:


# n must be defined
origins = Pointer.new(CGPoint.type, n) # this builds a pointer to n  
times CGPoint

CTFrameGetLineOrigins(frame, CFRange.new(0, n), origins)

2. How to access the individual CGPoints in the returned buffer?  
This is not an Objective-C / MacRuby array object. It is just an  
address to a buffer. Easy to do in C, but how to do in MacRuby?


Using Pointer#[] you can simply dereference a given slot in the  
pointer, as in C.


n.times { |i| p origins[i] } # should print nth points

Let me know if this works or not for you.


If it does, I can see this being a useful entry in Matt's book!

- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #679: U_REGEX_BAD_ESCAPE_SEQUENCE while requiring nokogiri

2010-05-06 Thread MacRuby
#679: U_REGEX_BAD_ESCAPE_SEQUENCE while requiring nokogiri
--+-
 Reporter:  dml...@…  |Owner:  lsansone...@…
 Type:  defect|   Status:  closed   
 Priority:  major |Milestone:  MacRuby 0.6  
Component:  MacRuby   |   Resolution:  duplicate
 Keywords:  nokogiri  |  
--+-
Changes (by martinlagarde...@…):

  * status:  new => closed
  * resolution:  => duplicate


Comment:

 Hi! Thanks for the report.

 This is a duplicate of #612

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #697: potential regex bug

2010-05-06 Thread MacRuby
#697: potential regex bug
---+
 Reporter:  daniel.fonta...@…  |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  blocker|Milestone:   
Component:  MacRuby|   Resolution:  duplicate
 Keywords: |  
---+
Changes (by martinlagarde...@…):

  * status:  new => closed
  * resolution:  => duplicate


Comment:

 Hi! Thanks for the report.

 This is a duplicate of #612

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread russell muetzelfeldt
> From: Thibault Martin-Lagardette 
> 
> What you can do is a "factory" just like this:
> 
...

> You can also do a more Cocoa-ish way:
> 
...

> Hope that helps!

yep, that all works... I'd rather be doing it in a more Ruby-ish way though... 
:)


Is the fact that the Ruby-standard initialize method is not called for Ruby 
classes descended from Obj-C classes expected? To me, at least, it violates the 
principle of least surprise...

for example, in ruby 1.9.1 we see initialize being called

ru...@worcestershire:~$ irb1.9.1 
irb(main):001:0> class C2 < String
irb(main):002:1>   attr_accessor :foo
irb(main):003:1>   def initialize foo = "default2"
irb(main):004:2> @foo = foo
irb(main):005:2> STDERR.puts "setting #{foo}"
irb(main):006:2>   end
irb(main):007:1> end
=> nil
irb(main):008:0> c2 = C2.new
setting default2
=> ""
irb(main):009:0> 


but not in macruby 0.6

ru...@alcazar:~$ macirb 
irb(main):001:0> class C2 < String
irb(main):002:1>   attr_accessor :foo
irb(main):003:1>   def initialize foo = "default2"
irb(main):004:2> @foo = foo
irb(main):005:2> STDERR.puts "setting #{foo}"
irb(main):006:2>   end
irb(main):007:1> end
=> nil
irb(main):008:0> c2 = C2.new
=> ""
irb(main):009:0> 


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread Thibault Martin-Lagardette
Glad it works :-)

The reason why your example doesn't work is because in MacRuby, String descends 
from NSString, which is a Foundation object. Foundation objects use "init" and 
not "initalize", and for syntaxic sugar reasons, #new is aliased to [[obj 
alloc] init] on Foundation objects :-).

$> macirb --simple-prompt
>> class A < String
>>  def initialize
>>super
>>puts "initialize"
>>  end
>>  def init
>>if super
>>  puts "init"
>>  self
>>end
>>  end
>> end
=> nil
>> A.new
init
=> ""


On non-Foundation objects, #new behaves as you expect (the ruby way)

$> macirb --simple-prompt
>> class A < Range
>>  def initialize(a, b)
>>super
>>puts "range initialize!"
>>  end
>> end
=> nil
>> A.new(1, 2)
range initialize!
=> 1..2

I agree this difference can be confusing, and I think it could find its place 
in a certain book *stares at Matt*

-- 
Thibault Martin-Lagardette



On May 6, 2010, at 20:51, russell muetzelfeldt wrote:

>> From: Thibault Martin-Lagardette 
>> 
>> What you can do is a "factory" just like this:
>> 
> ...
> 
>> You can also do a more Cocoa-ish way:
>> 
> ...
> 
>> Hope that helps!
> 
> yep, that all works... I'd rather be doing it in a more Ruby-ish way 
> though... :)
> 
> 
> Is the fact that the Ruby-standard initialize method is not called for Ruby 
> classes descended from Obj-C classes expected? To me, at least, it violates 
> the principle of least surprise...
> 
> for example, in ruby 1.9.1 we see initialize being called
> 
> ru...@worcestershire:~$ irb1.9.1 
> irb(main):001:0> class C2 < String
> irb(main):002:1>   attr_accessor :foo
> irb(main):003:1>   def initialize foo = "default2"
> irb(main):004:2> @foo = foo
> irb(main):005:2> STDERR.puts "setting #{foo}"
> irb(main):006:2>   end
> irb(main):007:1> end
> => nil
> irb(main):008:0> c2 = C2.new
> setting default2
> => ""
> irb(main):009:0> 
> 
> 
> but not in macruby 0.6
> 
> ru...@alcazar:~$ macirb 
> irb(main):001:0> class C2 < String
> irb(main):002:1>   attr_accessor :foo
> irb(main):003:1>   def initialize foo = "default2"
> irb(main):004:2> @foo = foo
> irb(main):005:2> STDERR.puts "setting #{foo}"
> irb(main):006:2>   end
> irb(main):007:1> end
> => nil
> irb(main):008:0> c2 = C2.new
> => ""
> irb(main):009:0> 
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Paul Howson
On 07/05/2010, at 1:08 PM, Matt Aimonetti wrote:

> Duly noted ;)

Actually Matt, could you perhaps consider a chapter on the subject of 
interfacing MacRuby to the various "Core xxx" C-language frameworks, which is 
not quite as straightforward as the seamless integration of MacRuby with Cocoa 
classes.

Paul Howson

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How to set up and retrieve returned buffer from CTFrameGetLineOrigins?

2010-05-06 Thread Paul Howson
On 07/05/2010, at 1:03 PM, Laurent Sansonetti wrote:

> Hi Paul,
> 
> You're right, the Pointer class must be used. Sorry about the lack of 
> documentation. Here is a snippet that might work:
> 
> # n must be defined
> origins = Pointer.new(CGPoint.type, n) # this builds a pointer to n times 
> CGPoint
> CTFrameGetLineOrigins(frame, CFRange.new(0, n), origins)
> 
> Using Pointer#[] you can simply dereference a given slot in the pointer, as 
> in C.
> 
> n.times { |i| p origins[i] } # should print nth points
> 
> Let me know if this works or not for you.
> 
> Laurent

Thanks Laurent. I will try it out.

Paul

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks

2010-05-06 Thread MacRuby
#692: Embedded MacRuby still tries to use ruby library from /Library/Frameworks
+---
 Reporter:  m...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  minor   |Milestone:  MacRuby 0.7  
Component:  MacRuby |   Resolution:  fixed
 Keywords:  |  
+---
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 This should be fixed in r4038. macruby_main() will automatically relocate
 the load paths if MacRuby.framework is present inside the current bundle's
 frameworks directory.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread Terry Moore
This is only true if you follow objc init I think... for example...


I came across this problem with NSWindowController and it took me a while to 
figure out.

class PasswordController < NSWindowController
def initialize
initWithWindowNibName("Password")  ##FAIL Never called! init called instead
end

class PrefController < NSWindowController

  def initialize(owner)
@owner = owner
initWithWindowNibName("Preferences")
  end
end


The first example fails and so I finally got that I needed the init method to 
make the window appear but I couldn't figure out why the second option worked.

Must have been a long day but clearly if designate an initialize with a param 
init is bypased...

so if I take the 
class A  "hi there"

so what is going on? I think there might need to be some clarity. 

Terry


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #612: RegexpError: U_REGEX_BAD_ESCAPE_SEQUENCE

2010-05-06 Thread MacRuby
#612: RegexpError: U_REGEX_BAD_ESCAPE_SEQUENCE
-+--
 Reporter:  cehoff...@…  |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  blocker  |   Milestone:   
Component:  MacRuby  |Keywords:   
-+--

Comment(by lsansone...@…):

 Also happens with:

 {{{
 > macruby -e "p /\0/"
 -e:1: regexp `\0 'compilation error: U_REGEX_BAD_ESCAPE_SEQUENCE
 }}}

 

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread russell muetzelfeldt
On 07/05/2010, at 2:17 PM, Thibault Martin-Lagardette wrote:

> Glad it works :-)
> 
> The reason why your example doesn't work is because in MacRuby, String 
> descends from NSString, which is a Foundation object. Foundation objects use 
> "init" and not "initalize", and for syntaxic sugar reasons, #new is aliased 
> to [[obj alloc] init] on Foundation objects :-).

oh, I understand the implementation detail, I just think it's wrong for a Ruby 
implementation to behave that way - this isn't just a matter of extending Ruby 
syntax to support access to Obj-C but rather a change that can break existing 
Ruby code...

what I would expect in this case is for the class I've written in ruby to have 
initialize called like all other classes written in ruby, and leave it to me to 
correctly call the designated initializer of my superclass, which I know is 
-init because I'm subclassing Obj-C code...


> On non-Foundation objects, #new behaves as you expect (the ruby way)

yeah, and with things like my OpenDirectory wrapper I can live with it... but 
when the behaviour of subclassing standard Ruby types differs between the 
reference implementation and MacRuby I'd be calling that a bug in MacRuby...


> I agree this difference can be confusing, and I think it could find its place 
> in a certain book *stares at Matt*

it doesn't need documenting, it needs fixing... :)

I guess it all depends whether you're looking at MacRuby as a new language for 
writing Cocoa applications, or as a runtime for Ruby applications on OSX...

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread Thibault Martin-Lagardette
The reason #new currently behaves this way is to work for every object, wether 
it's Ruby or Cocoa.
For #new to work like you expect (which I agree totally makes sense), instead 
of having #new aliasing [[obj alloc] init], we could alias it to [[obj alloc] 
initialize], and have -initialize redirect to -init on Foundation objects.
I don't know how expected that would be, or if it has any drawback...
Laurent, what's your take on that?

-- 
Thibault Martin-Lagardette



On May 6, 2010, at 22:09, russell muetzelfeldt wrote:

> On 07/05/2010, at 2:17 PM, Thibault Martin-Lagardette wrote:
> 
>> Glad it works :-)
>> 
>> The reason why your example doesn't work is because in MacRuby, String 
>> descends from NSString, which is a Foundation object. Foundation objects use 
>> "init" and not "initalize", and for syntaxic sugar reasons, #new is aliased 
>> to [[obj alloc] init] on Foundation objects :-).
> 
> oh, I understand the implementation detail, I just think it's wrong for a 
> Ruby implementation to behave that way - this isn't just a matter of 
> extending Ruby syntax to support access to Obj-C but rather a change that can 
> break existing Ruby code...
> 
> what I would expect in this case is for the class I've written in ruby to 
> have initialize called like all other classes written in ruby, and leave it 
> to me to correctly call the designated initializer of my superclass, which I 
> know is -init because I'm subclassing Obj-C code...
> 
> 
>> On non-Foundation objects, #new behaves as you expect (the ruby way)
> 
> yeah, and with things like my OpenDirectory wrapper I can live with it... but 
> when the behaviour of subclassing standard Ruby types differs between the 
> reference implementation and MacRuby I'd be calling that a bug in MacRuby...
> 
> 
>> I agree this difference can be confusing, and I think it could find its 
>> place in a certain book *stares at Matt*
> 
> it doesn't need documenting, it needs fixing... :)
> 
> I guess it all depends whether you're looking at MacRuby as a new language 
> for writing Cocoa applications, or as a runtime for Ruby applications on 
> OSX...
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread Thibault Martin-Lagardette
Hi!

I totally agree that it is a little confusing. But #new an #new(owner) are two 
different methods, especially in Obj-C.
Calling A.new(arg) cannot call -init, since -init doesn't take any argument, so 
it will call any initializer method that takes one argument :-).
This is why:

class A; def initialize; end; end; # Will never be called with A.new, because 
-init will be called instead
class A; def initialize(str); end; end; # Will be called with A.new(str), 
because -init cannot be called

It simply depends on how you define your initilizer method :-)

-- 
Thibault Martin-Lagardette



On May 6, 2010, at 21:54, Terry Moore wrote:

> This is only true if you follow objc init I think... for example...
> 
> 
> I came across this problem with NSWindowController and it took me a while to 
> figure out.
> 
> class PasswordController < NSWindowController
> def initialize
> initWithWindowNibName("Password")  ##FAIL Never called! init called 
> instead
> end
> 
> class PrefController < NSWindowController
>   
>   def initialize(owner)
> @owner = owner
> initWithWindowNibName("Preferences")
>   end
> end
> 
> 
> The first example fails and so I finally got that I needed the init method to 
> make the window appear but I couldn't figure out why the second option worked.
> 
> Must have been a long day but clearly if designate an initialize with a param 
> init is bypased...
> 
> so if I take the 
> class Adef initialize(b)
>  super
>   end
> end
>   example and do A.new("hi there") gives
> 
> initialize
> => "hi there"
> 
> so what is going on? I think there might need to be some clarity. 
> 
> Terry
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do I subclass Obj-C classes in MacRuby?

2010-05-06 Thread russell muetzelfeldt
On 07/05/2010, at 4:01 PM, Thibault Martin-Lagardette wrote:

> The reason #new currently behaves this way is to work for every object, 
> wether it's Ruby or Cocoa.
> For #new to work like you expect (which I agree totally makes sense), instead 
> of having #new aliasing [[obj alloc] init], we could alias it to [[obj alloc] 
> initialize], and have -initialize redirect to -init on Foundation objects.
> I don't know how expected that would be, or if it has any drawback...

perhaps I sounded a bit cranky in my last mail, if so my apologies...

you've pointed me to a perfectly viable workaround for my use case (thanks!), 
and macruby is still in development so I'll lay off the whinging that things 
aren't 100%... :)


cheers

Russell

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel