[MacRuby-devel] [MacRuby] #756: NArray won't build with MacRuby

2010-06-21 Thread MacRuby
#756: NArray won't build with MacRuby
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:   
+---
 The NArray gem won't build under MacRuby

 {{{
 > sudo macgem install narray
 Password:
 Building native extensions.  This could take a while...
 ERROR:  While executing gem ... (TypeError)
 can't convert Float into String
 can't convert Float into String (TypeError)
 }}}

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #756: NArray won't build with MacRuby

2010-06-21 Thread MacRuby
#756: NArray won't build with MacRuby
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by m...@…):

 Looks like this extension uses the RCLASS macro from ruby.h that doesn't
 seem to exist in MacRuby. Looks like its implementation specific? So,
 perhaps this isn't portable to MacRuby?

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #756: NArray won't build with MacRuby

2010-06-21 Thread MacRuby
#756: NArray won't build with MacRuby
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by martinlagarde...@…):

 I'd say the portability is kind of unlikely.

 `RCLASS` is a cast to `struct RClass`, which does not exist in MacRuby. We
 tend to think it is '''not''' a good idea to give access to the internal
 structures, especially since it's implementation dependent. Unfortunately,
 a lot of extension developers abuse this availability, most often
 unjustified though.

 What might be possible it to talk with the `narray` developer and try to
 see if there is another way to do whatever (s)he does with the class
 struct.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #756: NArray won't build with MacRuby

2010-06-21 Thread MacRuby
#756: NArray won't build with MacRuby
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by lsansone...@…):

 Do we know how narray uses the RCLASS macro exactly? RCLASS could simply
 be emulated as `#define RCLASS(o) ((Class)o)'.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #756: NArray won't build with MacRuby

2010-06-21 Thread MacRuby
#756: NArray won't build with MacRuby
+---
 Reporter:  m...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:   
Component:  MacRuby |Keywords:   
+---

Comment(by martinlagarde...@…):

 After inspection in the code, the dev is using `RCLASS` to determine
 wether or not an object is an instance of `NArray`:
 {{{
 #!c
 static void
  na_check_class_narray(VALUE v)
 {
   if (TYPE(v) != T_CLASS) {
 rb_raise(rb_eRuntimeError, "class required");
   }
   while (v) {
 if (v == cNArray || RCLASS(v)->m_tbl == RCLASS(cNArray)->m_tbl)
   return;
 v = RCLASS_SUPER(v);
   }
   rb_raise(rb_eRuntimeError, "need NArray or its subclass");
 }
 }}}

 We do not use `m_tbl`, so this cannot be emulated :-(.

 I am looking for a solution right now. We do have an equivalent of what is
 being done, but it is totally different and would require ugly `#ifdef
 MACRUBY` etc. Instead we'd rather find a solution that can be used with
 ruby and macruby :-)

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #590: Process.spawn not implemented

2010-06-21 Thread MacRuby
#590: Process.spawn not implemented
-+--
 Reporter:  hongli...@…  |Owner:  lsansone...@…
 Type:  task |   Status:  closed   
 Priority:  major|Milestone:  MacRuby 0.7  
Component:  MacRuby  |   Resolution:  fixed
 Keywords:   |  
-+--
Changes (by martinlagarde...@…):

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


Comment:

 Fixed in r4259 :-)

-- 
Ticket URL: 
MacRuby 

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


[MacRuby-devel] calculate table row height

2010-06-21 Thread niedhui
Hello,I'm new to cocoa and macruby,
  I want to start a tweetie-like app to learn macruby & cocoa, when display 
status list,I use NSTableView,and I must calculate the row height with `def 
tableView(table,heightOfRow:row);end` myself ,right? After googled  a while,I 
found the way  ,like this:


framework 'cocoa'
class String
  
  def height_with_width(width=100)
  
attributes = {}
attributes[NSFontAttributeName.to_sym] = NSFont.fontWithName("Lucida 
Grande", size:12)
attributes[NSParagraphStyleAttributeName.to_sym] = 
NSParagraphStyle.defaultParagraphStyle
  
text_storage = NSTextStorage.alloc.initWithString(self)
text_container = 
NSTextContainer.alloc.initWithContainerSize([width,1000])
layout_manager = NSLayoutManager.alloc.init
layout_manager.addTextContainer(text_container)
text_storage.addLayoutManager(layout_manager)
text_storage.addAttributes(attributes, range:NSMakeRange(0, 
text_storage.length))
text_container.setLineFragmentPadding(0.0)
layout_manager.glyphRangeForTextContainer(text_container)
layout_manager.usedRectForTextContainer(text_container).size.height
  end
end


puts "a".height_with_width#15
puts "b".height_with_width#15
puts "ab".height_with_width   #15
puts "中".height_with_width#18
puts "ak中".height_with_width  #19
puts "ak中".height_with_width(1)  #15+15+18


because the chinese characters, the height of a line is diffence, I want it to 
be same ,like all return 19 , How Can I Fix This ? HELP!___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel